aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-01-15 19:19:42 +0000
committerChris Lattner <sabre@nondot.org>2009-01-15 19:19:42 +0000
commit13fd416b3d2b0c69247f2691f0ff344100e0faff (patch)
tree4edfd509fd96d774d2f5e35627f01187861dbf59
parent72b1b15ee88aac0a63e2c1dc53fe22f5ab297b20 (diff)
PR3330: given an enum like this:
enum E { A = 1U, B }; Don't make an implicit cast expr of null for B. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62274 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 07966399da..e9435521d1 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3684,8 +3684,9 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, DeclTy *EnumDeclX,
ECD->setInitVal(InitVal);
// Adjust the Expr initializer and type.
- ECD->setInitExpr(new ImplicitCastExpr(NewTy, ECD->getInitExpr(),
- /*isLvalue=*/false));
+ if (ECD->getInitExpr())
+ ECD->setInitExpr(new ImplicitCastExpr(NewTy, ECD->getInitExpr(),
+ /*isLvalue=*/false));
if (getLangOptions().CPlusPlus)
// C++ [dcl.enum]p4: Following the closing brace of an
// enum-specifier, each enumerator has the type of its