[cfe-commits] r125556 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/CXX/class.access/p6.cpp

John McCall rjmccall at apple.com
Mon Feb 14 23:12:36 PST 2011


Author: rjmccall
Date: Tue Feb 15 01:12:36 2011
New Revision: 125556

URL: http://llvm.org/viewvc/llvm-project?rev=125556&view=rev
Log:
Return a declaration to the parser when creating a field in C++ so that
the parser will complete the declarator with a valid decl and thus trigger
delayed diagnostics for it.  It certainly looks like we were intentionally
returning null here, but I couldn't find any good reason for it, and there
wasn't a comment, so farewell to all that.


Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/CXX/class.access/p6.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=125556&r1=125555&r2=125556&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Feb 15 01:12:36 2011
@@ -1077,10 +1077,8 @@
   if (Deleted) // FIXME: Source location is not very good.
     SetDeclDeleted(Member, D.getSourceRange().getBegin());
 
-  if (isInstField) {
+  if (isInstField)
     FieldCollector->Add(cast<FieldDecl>(Member));
-    return 0;
-  }
   return Member;
 }
 

Modified: cfe/trunk/test/CXX/class.access/p6.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/p6.cpp?rev=125556&r1=125555&r2=125556&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/p6.cpp (original)
+++ cfe/trunk/test/CXX/class.access/p6.cpp Tue Feb 15 01:12:36 2011
@@ -139,3 +139,17 @@
     template <A::Enum en> class bar {}; // expected-error {{'Enum' is a private member of 'test5::A'}}
   };
 }
+
+namespace test6 {
+  class A {
+  public: class public_inner {};
+  protected: class protected_inner {};
+  private: class private_inner {}; // expected-note {{declared private here}}
+  };
+
+  class B : A {
+    public_inner a;
+    protected_inner b;
+    private_inner c; // expected-error {{ 'private_inner' is a private member of 'test6::A'}}
+  };
+}





More information about the cfe-commits mailing list