[RFA] PR c++/41020

Jason Merrill jason@redhat.com
Sat Oct 24 00:45:00 GMT 2009


On 10/23/2009 02:27 PM, Dodji Seketeli wrote:
> On Fri, Oct 23, 2009 at 01:07:07PM -0700, Jason Merrill wrote:
>> What happens with block-scope extern declarations?
>
> This small example compiles fine with the patch:
>
> void
> foo ()
> {
>    extern int fork (void);
> }
>
> class frok
> {
>    int this_errno;
>    friend int fork (void);
> };
>
> int
> fork (void)
> {
>    frok grouped;
>    return grouped.this_errno;
> }

Does it also compile without the patch?  What I was trying to get at 
was, are we doing something else to make block-scope externs work that 
we should also do for friend functions?  I don't know the answer.

In any case, a friend declaration should not match a builtin 
declaration.  It shouldn't give an error, either, it should declare a 
different function.

Jason



More information about the Gcc-patches mailing list