This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g++ Koenig-lookup bug


> I think Koenig lookup should find both B::f and ::f, and  
> call ::f, here:
>   
>   struct A {};
>   void f(A&);
>   struct B {
>     void f(B&) { A a; f(a); }
>   };

No, it shouldn't. [basic.lookup.koenig]/2 sez

>> If the ordinary unqualified lookup of the name finds the
>> declaration of a class member function, the associated namespaces
>> and classes are not considered.

So we look for f, find B::f, and stop. Overload resolution then finds
no match.

Unfortunately, the standard rarely gives rationale; and I couldn't
come up with one, either.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]