[cfe-commits] pr12328 PATCH: Friend method declaration doesn't require method to be visible

Stepan Dyatkovskiy stpworld at narod.ru
Thu Aug 9 03:03:42 PDT 2012


Hi, Nikola.
Thanks you again for updating the patch. The only thing you missed to do 
is to pass additional parameter to CheckLookupAccess in SemaDeclCXX.cpp:
CheckLookupAccess(Previous, *true*);
"true" means - use current declaration context in delayed check. Since 
as I wrote before we're parsing class with "friend" declaration, but 
diagnostics is invoked for class with definition of friend member 
itself, and improper context is used by default.

Well, I attached two patches. The first is without any fixes in delayed 
diagnostics. I just implemented CheckLookupAccessNow, that doesn't use 
DD. Ss McCall said: "because we know exactly what we're checking access 
to, and we're getting nothing out of delaying the diagnostic."
The patch name is pr12328-checknow.patch

But IMHO, the DD works a little bit improperly. I think it is not proper 
to use decl context for class for which it was invoked. We should use 
decl context for class/method for which it was *requested*.
The patch name is ppr12328-fixedDD.patch

Also I patch with testcases is attached.

-Stepan.

Nikola Smiljanic wrote:
> I was just looking for something to work on myself when I saw your
> patch and gave it a try. I'm not in position to comment the
> implementation but I guess that John McCall is the right person to CC
> when (or if) you get back to this issue.
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12328-checknow.patch
Type: text/x-patch
Size: 3322 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120809/7abbfe1d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12328-fixedDD.patch
Type: text/x-patch
Size: 5323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120809/7abbfe1d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12328-testcases.patch
Type: text/x-patch
Size: 952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120809/7abbfe1d/attachment-0002.bin>


More information about the cfe-commits mailing list