summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
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
commite53c036d85e9b504fa1af62223999777f30c942b (patch)
treee6fa86ecdb956e72a62e9f5dddbc18206aed4544 /clang/lib/Sema
parenta705b04d7fecca53c63c07dd9adce6475ae23619 (diff)
downloadbcm5719-llvm-e53c036d85e9b504fa1af62223999777f30c942b.tar.gz
bcm5719-llvm-e53c036d85e9b504fa1af62223999777f30c942b.zip
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
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 07966399da8..e9435521d18 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud