[cfe-commits] protected anonymous union member not visible in derived class
John McCall
rjmccall at apple.com
Thu Aug 16 14:31:57 PDT 2012
On Aug 16, 2012, at 7:44 AM, Nikola Smiljanic wrote:
> I see no regressions but is this what you had in mind? Where should
> the test for this go?
Please don't strip all context from a message. I get way too much email;
it's very nice to not have to reconstruct a conversation from scratch.
You should make this a non-optional argument; I think that should be
fine for all the callers. (Your implementation isn't safe against null
lookup results anyway, but it doesn't matter, because you don't need
to rely on that.)
- // FIXME: use the real found-decl info!
- DeclAccessPair foundDecl = DeclAccessPair::make(field, field->getAccess());
+ assert(R->getResultKind() == LookupResult::Found);
+ NamedDecl *ND = R->getFoundDecl();
+ DeclAccessPair foundDecl = DeclAccessPair::make(ND, ND->getAccess());
That is not the real found-decl info. :) You're implicitly stripping off
UsingShadowDecls and the found access path. You just want *R->begin().
@@ -763,6 +765,10 @@ Sema::BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS,
result = BuildFieldReferenceExpr(*this, result, baseObjectIsPointer,
EmptySS, field, foundDecl,
memberNameInfo).take();
+ QualType BaseType = baseObjectExpr->getType();
+ if (BaseType->isPointerType())
+ BaseType = BaseType->castAs<PointerType>()->getPointeeType();
+ R->setBaseObjectType(BaseType);
This is in the implicit member access case, right? You don't need to check
for a pointer type — the base expression is always 'this' and therefore
always has pointer type.
John.
More information about the cfe-commits
mailing list