I believe that the call to foo in line 35 should resolve to the function defined in line 28/29.
# 1 "gnubug.cc" # 1 "<built-in>" # 1 "<command line>" # 1 "gnubug.cc" # 1 "/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/stddef.h" 1 3 4 # 152 "/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/stddef.h" 3 4 typedef int ptrdiff_t; # 214 "/local/lib/gcc/i686-pc-linux-gnu/4.0.0/include/stddef.h" 3 4 typedef unsigned int size_t; # 2 "gnubug.cc" 2 class A {}; template <class X> struct default_return_type { typedef void type; }; template <> struct default_return_type<A> { typedef int type; }; template <template <class> class RetType> struct Base { typedef typename RetType<A>::type surrogate_t; template <class T> void foo(T&, typename RetType<T>::type * ret) {} // line 29 void foo1(A&, surrogate_t * ret) {} }; struct Concrete : Base<default_return_type> { void bar(A& a) { foo(a, __null); } // line 35 void bar0(A& a) { int * x = __null; foo(a, x); } void bar1(A& a) { foo1(a, __null); } }; -- Summary: overload resolution does not find templated function Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter dot pirkelbauer at tamu dot edu CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23055