PR3330: given an enum like this:

enum E {
 A = 1U,
 B
};

Don't make an implicit cast expr of null for B.

llvm-svn: 62274
This commit is contained in:
Chris Lattner 2009-01-15 19:19:42 +00:00
parent a705b04d7f
commit e53c036d85
1 changed files with 3 additions and 2 deletions

View File

@ -3684,8 +3684,9 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
ECD->setInitVal(InitVal); ECD->setInitVal(InitVal);
// Adjust the Expr initializer and type. // Adjust the Expr initializer and type.
ECD->setInitExpr(new ImplicitCastExpr(NewTy, ECD->getInitExpr(), if (ECD->getInitExpr())
/*isLvalue=*/false)); ECD->setInitExpr(new ImplicitCastExpr(NewTy, ECD->getInitExpr(),
/*isLvalue=*/false));
if (getLangOptions().CPlusPlus) if (getLangOptions().CPlusPlus)
// C++ [dcl.enum]p4: Following the closing brace of an // C++ [dcl.enum]p4: Following the closing brace of an
// enum-specifier, each enumerator has the type of its // enum-specifier, each enumerator has the type of its