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.

llvm-svn: 125556
This commit is contained in:
John McCall 2011-02-15 07:12:36 +00:00
parent 0217dfc2ba
commit 25849cab8b
2 changed files with 15 additions and 3 deletions

View File

@ -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;
}

View File

@ -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'}}
};
}