In the following code snippet: namespace odd {
template<class T> void f(T&); } namespace N { struct A {}; int f(A&); void g() { A a; using odd::f; int assert = sizeof(f(a)); // <--- here } } according to the standard 3.4.2/2 int N::f(A&) should be found. But gcc finds void odd::f(T&). If I put int f(A&) as a friend declaration inside A's definition, f(A&) is rightly found. Comeau online 4.3.3 BETA August 4, 2003 finds int f(A&) in either case. I think this is an associated namespace search gcc bug. Here are my details: [EMAIL PROTECTED] exp]$ gcc -v -save-temps -Wall exp.cpp Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- infodir=/usr/share/info --enable-shared --enable-threads=posix --disable- checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind- exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3) /usr/libexec/gcc/i386-redhat-linux/3.4.3/cc1plus -E -quiet -v - D_GNU_SOURCE exp.cpp -Wall -o exp.ii ignoring nonexistent directory "/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../.. /i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3 /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/i386- redhat-linux /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/backward /usr/local/include /usr/lib/gcc/i386-redhat-linux/3.4.3/include /usr/include End of search list. /usr/libexec/gcc/i386-redhat-linux/3.4.3/cc1plus -fpreprocessed exp.ii - quiet -dumpbase exp.cpp -auxbase exp -Wall -version -o exp.s GNU C++ version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3) (i386-redhat- linux) compiled by GNU C version 3.4.3 20050227 (Red Hat 3.4.3-22.fc3). GGC heuristics: --param ggc-min-expand=64 --param ggc-min- heapsize=64423 exp.cpp: In function `void N::g()': exp.cpp:17: error: invalid application of `sizeof' to a void type exp.cpp:17: warning: unused variable 'assert' Here is exp.ii: # 1 "exp.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "exp.cpp" namespace odd { template<class T> void f(T&); } namespace N { struct A {}; int f(A&); void g() { A a; using odd::f; int assert = sizeof(f(a)); } } -- Summary: Argument-dependent name lookup associated namespace search bug Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: maxim dot yegorushkin at gmail dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21615