PR12788: Remove unnecessary and incorrect special case for indirect fields.

This caused us to skip a step that was essential for correct access control.

llvm-svn: 199522
This commit is contained in:
Richard Smith 2014-01-17 22:29:43 +00:00
parent 5d05ed1d17
commit 59d26d2e67
2 changed files with 16 additions and 8 deletions

View File

@ -1752,14 +1752,7 @@ Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS,
assert(!R.empty() && !R.isAmbiguous());
SourceLocation loc = R.getNameLoc();
// We may have found a field within an anonymous union or struct
// (C++ [class.union]).
// FIXME: template-ids inside anonymous structs?
if (IndirectFieldDecl *FD = R.getAsSingle<IndirectFieldDecl>())
return BuildAnonymousStructUnionMemberReference(SS, R.getNameLoc(), FD,
R.begin().getPair());
// If this is known to be an instance access, go ahead and build an
// implicit 'this' expression now.
// 'this' expression now.

View File

@ -153,3 +153,18 @@ namespace test2 {
t->Base::spriv++; // expected-error 2 {{private member}}
}
}
namespace PR12788 {
class A {
protected:
struct {
int x;
};
};
class B : A {
void f() {
++x;
A::x++;
}
};
}