Consider: void f(); namespace N { using ::f; } void h() { void (& a)() = f; // ok void (& b)() = N::f; // error: invalid initialization of non-const reference of // type ‘void (&)()’ from a temporary of type ‘void ()()’ } Since in h, f and N::f are simply two ways of naming the same function, the error seems unwarranted to me. Comeau 4.3.9 accepts the code.
Confirmed. Fails since 3.4.
Confirmed again. Funny enough, this works: ----------------- void f(); namespace N { using ::f; } void h() { void (& b)() = N::f; // not ok void (& c)() = *&N::f; // ok!? } ----------------- W.
Subject: Bug 35650 Author: jakub Date: Tue Apr 29 08:58:20 2008 New Revision: 134788 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134788 Log: PR c++/35650 * parser.c (cp_parser_lookup_name): Look through single function OVERLOAD. * g++.dg/init/ref17.C: New test. Added: trunk/gcc/testsuite/g++.dg/init/ref17.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 35650 Author: jakub Date: Tue Apr 29 08:58:58 2008 New Revision: 134789 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134789 Log: PR c++/35650 * parser.c (cp_parser_lookup_name): Look through single function OVERLOAD. * g++.dg/init/ref17.C: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/g++.dg/init/ref17.C Modified: branches/gcc-4_3-branch/gcc/cp/ChangeLog branches/gcc-4_3-branch/gcc/cp/parser.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed.