[cfe-commits] r62274 - /cfe/trunk/lib/Sema/SemaDecl.cpp

Chris Lattner sabre at nondot.org
Thu Jan 15 11:19:42 PST 2009


Author: lattner
Date: Thu Jan 15 13:19:42 2009
New Revision: 62274

URL: http://llvm.org/viewvc/llvm-project?rev=62274&view=rev
Log:
PR3330: given an enum like this:

enum E {
 A = 1U,
 B
};

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


Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=62274&r1=62273&r2=62274&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu Jan 15 13:19:42 2009
@@ -3684,8 +3684,9 @@
     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





More information about the cfe-commits mailing list