diff options
author | John McCall <rjmccall@apple.com> | 2011-02-15 07:12:36 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-15 07:12:36 +0000 |
commit | b25b295fdfc443bdf060e860a21f6f01d9fbdc18 (patch) | |
tree | 8ad2fbfcdf6f22b3b9fd6b194abd2842366d447e | |
parent | 9b7da1c46d6d2849f9cb51328d7fcddf2c417672 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125556 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 4 | ||||
-rw-r--r-- | test/CXX/class.access/p6.cpp | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 370def568e..f929aa039e 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -1077,10 +1077,8 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, 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; } diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp index 8795708474..1112699c8b 100644 --- a/test/CXX/class.access/p6.cpp +++ b/test/CXX/class.access/p6.cpp @@ -139,3 +139,17 @@ namespace test5 { 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'}} + }; +} |