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

Nick Lewycky nicholas at mxc.ca
Fri Mar 9 23:47:08 PST 2012


Author: nicholas
Date: Sat Mar 10 01:47:07 2012
New Revision: 152489

URL: http://llvm.org/viewvc/llvm-project?rev=152489&view=rev
Log:
Slightly tweak this condition. "isTransparentContext()" was checking whether an
enum is scoped or not, which is not relevant here. Instead, phrase the loop in
the same terms that the standard uses, instead of this awkward set of
conditions that is *nearly* equal.

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=152489&r1=152488&r2=152489&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Mar 10 01:47:07 2012
@@ -8092,8 +8092,7 @@
       // Find the context where we'll be declaring the tag.
       // FIXME: We would like to maintain the current DeclContext as the
       // lexical context,
-      while (SearchDC->isRecord() || SearchDC->isTransparentContext() ||
-             SearchDC->isObjCContainer())
+      while (!SearchDC->isFileContext() && !SearchDC->isFunctionOrMethod())
         SearchDC = SearchDC->getParent();
 
       // Find the scope where we'll be declaring the tag.

Modified: cfe/trunk/test/SemaCXX/enum-scoped.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/enum-scoped.cpp?rev=152489&r1=152488&r2=152489&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/enum-scoped.cpp (original)
+++ cfe/trunk/test/SemaCXX/enum-scoped.cpp Sat Mar 10 01:47:07 2012
@@ -184,3 +184,8 @@
   enum eCOLORS { Last };
   Enum<eCOLORS> e;
 }
+
+namespace test7 {
+  enum class E { e = (struct S*)0 == (struct S*)0 };
+  S *p;
+}





More information about the cfe-commits mailing list