[cfe-commits] r145874 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/enum-scoped.cpp

Eli Friedman eli.friedman at gmail.com
Mon Dec 5 16:10:34 PST 2011


Author: efriedma
Date: Mon Dec  5 18:10:34 2011
New Revision: 145874

URL: http://llvm.org/viewvc/llvm-project?rev=145874&view=rev
Log:
Make sure we perform lvalue-to-rvalue conversions for enum initializers.  PR11484.


Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/SemaCXX/enum-scoped.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=145874&r1=145873&r2=145874&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Dec  5 18:10:34 2011
@@ -9449,6 +9449,9 @@
   if (Val && DiagnoseUnexpandedParameterPack(Val, UPPC_EnumeratorValue))
     Val = 0;
 
+  if (Val)
+    Val = DefaultLvalueConversion(Val).take();
+
   if (Val) {
     if (Enum->isDependentType() || Val->isTypeDependent())
       EltTy = Context.DependentTy;

Modified: cfe/trunk/test/SemaCXX/enum-scoped.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/enum-scoped.cpp?rev=145874&r1=145873&r2=145874&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/enum-scoped.cpp (original)
+++ cfe/trunk/test/SemaCXX/enum-scoped.cpp Mon Dec  5 18:10:34 2011
@@ -142,3 +142,8 @@
     (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, };
+}





More information about the cfe-commits mailing list