[PATCH] Avoid llvm_unreachable when friend-ing a using declaration

Stephen Lin swlin at post.harvard.edu
Thu Mar 28 14:58:15 PDT 2013


Thanks for the review!

By the way, the rationale for this being an error seems to be:

8.1 p1:
    "When the declarator-id is qualified, the declaration shall refer
to a previously declared member of the class or namespace to which the
qualifier refers ... the member shall not merely have been introduced
by a using-declaration in the scope of the class or namespace
nominated by the nested-name-specifier of the declarator-id."

Credit for finding that goes to Johannes Schaub - litb on
StackOverflow (http://stackoverflow.com/questions/15692660/is-it-legal-to-friend-a-function-via-a-using-declaration).

Stephen

On Thu, Mar 28, 2013 at 4:27 PM, John McCall <rjmccall at apple.com> wrote:
> On Mar 20, 2013, at 6:48 PM, Stephen Lin <swlin at post.harvard.edu> wrote:
>> Here's an updated patch: no need to propagate any extra info.
>>
>> The new error message is "cannot befriend target of using
>> declaration", which works for attempts to befriend both namespace and
>> record level using declarations of functions and function templates.
>
> Looks good to me.
>
> John.



More information about the cfe-commits mailing list