Make sure we perform lvalue-to-rvalue conversions for enum initializers. PR11484.

llvm-svn: 145874
This commit is contained in:
Eli Friedman 2011-12-06 00:10:34 +00:00
parent 18e2fe47fa
commit 7c6515a653
2 changed files with 8 additions and 0 deletions

View File

@ -9449,6 +9449,9 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
if (Val && DiagnoseUnexpandedParameterPack(Val, UPPC_EnumeratorValue))
Val = 0;
if (Val)
Val = DefaultLvalueConversion(Val).take();
if (Val) {
if (Enum->isDependentType() || Val->isTypeDependent())
EltTy = Context.DependentTy;

View File

@ -142,3 +142,8 @@ namespace test6 {
(void) A::e; // expected-error {{incomplete type 'test6::A' named in nested name specifier}}
}
}
namespace PR11484 {
const int val = 104;
enum class test1 { owner_dead = val, };
}