------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-29 16:02 ------- If you called a different function name instead of a template one, I get the following error: t.cc: In function ‘void foo(const A<T>&)’: t.cc:7: error: there are no arguments to ‘foo1’ that depend on a template parameter, so a declaration of ‘foo1’ must be available t.cc:7: error: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
template <class T> struct A { T t; }; // Swap following 2 functions to get conforming C++ template <int i> struct B {static const int t = i;}; template<class T> void foo(const A<T>& data) { foo1((int)data.t); } void foo1(int data); In fact this has nothing to do with dependent or not, see the following code (which gives the same error message in 3.3.3 also): template <class T> struct A { T t; }; // Swap following 2 functions to get conforming C++ template <int i> struct B {static const int t = i;}; template<class T> void foo1(const A<T>& data); void foo(const A<int>& data) { foo1((int)data.t); } void foo1(int data); So the error message problem, in fact that is PR 17166 which I am going to mark this as a dup of. *** This bug has been marked as a duplicate of 17166 *** -- What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |RESOLVED Keywords| |diagnostic Resolution| |DUPLICATE Summary|Uninformative diagnostic for|Uninformative diagnostic for |name lookup from template |name lookup for template |function |functions http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21808