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

Stephen Lin swlin at post.harvard.edu
Wed Mar 20 18:48:07 PDT 2013


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.

Stephen


On Wed, Mar 20, 2013 at 1:57 AM, John McCall <rjmccall at apple.com> wrote:
>
> On Mar 12, 2013, at 2:30 PM, Stephen Lin <swlin at post.harvard.edu> wrote:
>
> Hi,
>
> This is a bug fix for LLVM Bugzilla bug #15485
> (http://llvm.org/bugs/show_bug.cgi?id=15485)
>
> Basically, llvm_unreachable is currently hit because CheckOverload assumes
> that a new function declaration in record scope should trigger member
> function hiding rules, but this is not the case for "friend" declarations.
>
> I believe the code causing the issue is illegal (the friend declaration
> should not friend the function brought into scope by the using) and should
> result in an error; this is what happens after the patch without any extra
> effort (although the error could possibly be improved?).
>
>
> I agree that the error could be improved.  Would you mind tackling that if
> it's straightforward?  It's SemaDecl.cpp:2279.  You might need to propagate
> down isFriend.
>
> John.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: friend-using-15485-2.patch
Type: application/octet-stream
Size: 3112 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130320/fcb6ddcd/attachment.obj>


More information about the cfe-commits mailing list