template bug

Erik Smith ersmith@ucsd.edu
Wed Apr 19 06:42:00 GMT 2000


GCC version: 2.95.2
system type: red hat linux 6.0
All options you passed to the compiler:  g++ -fexceptions

g++ should be able to resolve the call to the overloaded function:

Here is the code and the output:

template<class T,class S> void foo(T &t,S &s) {}
template<class T> void foo(T &t,const char *s) {}
class ABC {};

inline void foo2() {
	ABC abc;
	foo(abc,"test");
}

/data/product/lib2/string_util.h: In function `void foo2()':
/data/product/lib2/string_util.h:129: call of overloaded `foo (ABC &, const 
char[3])' is ambiguous
/data/product/lib2/string_util.h:124: candidates are: void foo<ABC, const 
char[3]>(ABC &, const char (&)[3])
/data/product/lib2/string_util.h:125:                 void foo<ABC>(ABC &, 
const char *)





More information about the Gcc-bugs mailing list