[cfe-commits] r91956 - in /cfe/trunk: lib/Sema/SemaAccess.cpp test/SemaCXX/access.cpp

John McCall rjmccall at apple.com
Tue Dec 22 16:37:41 PST 2009


Author: rjmccall
Date: Tue Dec 22 18:37:40 2009
New Revision: 91956

URL: http://llvm.org/viewvc/llvm-project?rev=91956&view=rev
Log:
Set a member's access specifier even if it doesn't match the previous specifier.
Prevents an assert on successive redeclarations.

Fixed PR5573.


Modified:
    cfe/trunk/lib/Sema/SemaAccess.cpp
    cfe/trunk/test/SemaCXX/access.cpp

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Tue Dec 22 18:37:40 2009
@@ -37,6 +37,8 @@
       << MemberDecl << LexicalAS;
     Diag(PrevMemberDecl->getLocation(), diag::note_previous_access_declaration)
       << PrevMemberDecl << PrevMemberDecl->getAccess();
+
+    MemberDecl->setAccess(LexicalAS);
     return true;
   }
 

Modified: cfe/trunk/test/SemaCXX/access.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/access.cpp?rev=91956&r1=91955&r2=91956&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/access.cpp (original)
+++ cfe/trunk/test/SemaCXX/access.cpp Tue Dec 22 18:37:40 2009
@@ -21,3 +21,14 @@
 private:
     template<typename T> struct A {}; // expected-error {{'A' redeclared with 'private' access}}
 };
+
+// PR5573
+namespace test1 {
+  class A {
+  private:
+    class X; // expected-note {{previously declared 'private' here}}
+  public:
+    class X; // expected-error {{ 'X' redeclared with 'public' access}}
+    class X {};
+  };
+}





More information about the cfe-commits mailing list