NOTE: Defaulting component because reported component no longer exists Consider the following piece of code: void foo (){} template < typename T > void bar (const T &arg) { (void) arg; } int main () { bar (foo); } G++ 3.3, 3.4, and ICC 7.1 consider it invalid: bar (foo) must be written bar (&foo). Nevertheless 3.5 accepts it. I'm tempted to say this piece of code is invalid, but IANALL :) Environment: System: Linux nostromo 2.4.25 #2 Mon Mar 15 12:03:26 CET 2004 i686 GNU/Linux Architecture: i686 host: i486-pc-linux-gnu build: i486-pc-linux-gnu target: i486-pc-linux-gnu configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc --prefix=/usr/lib/gcc-snapshot --enable-shared --with-system-zlib --enable-nls --enable-threads=posix --without-included-gettext --disable-werror --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk i486-linux-gnu How-To-Repeat: ~/tmp % icc foo.cc foo.cc(18): error: no instance of function template "bar" matches the argument list argument types are: (void ()) bar (foo); ^ compilation aborted for foo.cc (code 2) ~/tmp % g++-3.4 foo.cc foo.cc: In function `int main()': foo.cc:18: error: pas de fonction concordante pour l'appel de «bar(void (&)())» ~/tmp % g++-3.5 foo.cc ~/tmp %
Your code is valid, so mainline's behavior is correct. GCC 3.4.1 will also accept it. An explanation and the patches that fixed the compiler can be found in PR 3518. Btw, your code is accepted by gcc 2.95.x, rejected by gcc 3.0.x, again accepted by gcc 3.1 - 3.2.1, again rejected by gcc 3.2.2 - 3.4.0, and (hopefully) finally accepted by 3.4.1 and later. ICC 8.0 also accepts the code.