[cfe-commits] pr12328 PATCH: Friend method declaration doesn't require method to be visible
John McCall
rjmccall at apple.com
Thu Apr 19 15:52:41 PDT 2012
On Apr 19, 2012, at 3:45 AM, Stepan Dyatkovskiy wrote:
> ping.
> Stepan Dyatkovskiy wrote:
>> ping.
>> Stepan Dyatkovskiy wrote:
>>> ping.
>>> Stepan Dyatkovskiy wrote:
>>>> Hi all.
>>>> Please find patch in attachment for review.
>>>> I suppose that this check was not implemented yet, since I couldn't
>>>> found it anywhere. The friend method availability check was inserted in
>>>> Sema::ActOnFriendFunctionDecl.
>>>> I also added "DeclContext *FromContext" to the AccessedEntity class. It
>>>> allows to ask DelayedDiagnostic to use context that was "current" when
>>>> this diagnostics was requested. It is usefull in our case, since we
>>>> requested diagnostics when we're parsing class with "friend"
>>>> declaration, but diagnostics is invoked for class with definition of
>>>> friend member itself.
Sorry for the delay.
Please include test cases when you submit patches. Also, I'm afraid your
patch is out-of-date.
+ if (Previous.getResultKind() == LookupResult::Found &&
+ Previous.getFoundDecl()->isCXXClassMember())
+ CheckLookupAccess(Previous);
This is a bit silly, because we know exactly what we're checking access to,
and we're getting nothing out of delaying the diagnostic. It would be better
to provide a different CheckFriendAccess entrypoint that happens to
suppress diagnostic delay.
Also, you'll need to do this same access check in SemaTemplateInstantiateDecl
so that it happens in template instantiations.
John.
More information about the cfe-commits
mailing list