The program below (example from 3.4.1, p3 corrected by DR139 -- http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#139) is supposed to return 0. It exits with 1 when compiled with gcc 3.2 suggesting that gcc fails to correctly implement unqualified lookup. This might be related to PR #11296: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11296 Martin typedef int f; namespace N { struct A { friend int f (A) { return 1; } operator int () const { return 0; } int g (A a) { return f (a); } }; } int main () { return N::A ().g (N::A ()); }
Confirmed. What a wicked example :-/
This is fixed in 4.1.0 as what is happening before was the friend was injecting when it should not have been. This was fixed by the patch which fixed PR 7874.