This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g++ Koenig-lookup bug
- To: ncm at cantrip dot org
- Subject: Re: g++ Koenig-lookup bug
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sun, 18 Oct 1998 17:06:52 +0100
- CC: egcs at cygnus dot com
- References: <709pof$d75$1@cronkite.cygnus.com>
> 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