[llvm-branch-commits] [cfe-branch] r195720 - Merging r195687:

Bill Wendling isanbard at gmail.com
Mon Nov 25 20:09:45 PST 2013


Author: void
Date: Mon Nov 25 22:09:45 2013
New Revision: 195720

URL: http://llvm.org/viewvc/llvm-project?rev=195720&view=rev
Log:
Merging r195687:
------------------------------------------------------------------------
r195687 | rsmith | 2013-11-25 13:30:29 -0800 (Mon, 25 Nov 2013) | 3 lines

PR18044: Reject declarations of enumtype::X early to avoid an assertion in
downstream code.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/Sema/SemaDecl.cpp
    cfe/branches/release_34/test/SemaCXX/enum-scoped.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 25 22:09:45 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195326,195329,195367,195384,195501,195547,195556,195558,195620
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195268,195283,195326,195329,195367,195384,195501,195547,195556,195558,195620,195687
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Sema/SemaDecl.cpp?rev=195720&r1=195719&r2=195720&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Sema/SemaDecl.cpp (original)
+++ cfe/branches/release_34/lib/Sema/SemaDecl.cpp Mon Nov 25 22:09:45 2013
@@ -4223,7 +4223,7 @@ NamedDecl *Sema::HandleDeclarator(Scope
 
     bool EnteringContext = !D.getDeclSpec().isFriendSpecified();
     DC = computeDeclContext(D.getCXXScopeSpec(), EnteringContext);
-    if (!DC) {
+    if (!DC || isa<EnumDecl>(DC)) {
       // If we could not compute the declaration context, it's because the
       // declaration context is dependent but does not refer to a class,
       // class template, or class template partial specialization. Complain

Modified: cfe/branches/release_34/test/SemaCXX/enum-scoped.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/SemaCXX/enum-scoped.cpp?rev=195720&r1=195719&r2=195720&view=diff
==============================================================================
--- cfe/branches/release_34/test/SemaCXX/enum-scoped.cpp (original)
+++ cfe/branches/release_34/test/SemaCXX/enum-scoped.cpp Mon Nov 25 22:09:45 2013
@@ -282,3 +282,17 @@ namespace rdar15124329 {
   static_assert(T2 == B::T, "");
 }
 
+namespace PR18044 {
+  enum class E { a };
+
+  int E::e = 0; // expected-error {{does not refer into a class}}
+  void E::f() {} // expected-error {{does not refer into a class}}
+  struct E::S {}; // expected-error {{no struct named 'S'}}
+  struct T : E::S {}; // expected-error {{expected class name}}
+  enum E::E {}; // expected-error {{no enum named 'E'}}
+  int E::*p; // expected-error {{does not point into a class}}
+  using E::f; // expected-error {{no member named 'f'}}
+
+  using E::a; // ok!
+  E b = a;
+}





More information about the llvm-branch-commits mailing list