template unification bug?

Stefan Meixner (none) stefan@emskopp.a.shuttle.de
Wed Feb 11 14:34:00 GMT 1998


Hi,

right now I do not see why the following code does not
compile!
Please correct me if I am wrong!


> g++ -v
Reading specs from /usr/lib/gcc-lib/i486-pc-linux-gnulibc1/egcs-2.91.07/specs
gcc version egcs-2.91.07 980205 (gcc-2.8.0 release)

> g++ -o unibug unibug.cc
unibug.cc: In function `int main()':
unibug.cc:25: incomplete type unification
unibug.cc:25: no matching function for call to `foo (int)'

======================================================
// unibug.cc

template<class T> class A;

template<class T> A<T> foo(int a);

template<class T> 
class A
{
public:
   A() { }
   A(int a) { }
};

template<class T> A<T> foo(int a)
{
   return A<T>(a);
}

int main()
{

   A<double>  c;

   c = foo(5);

   return 0;
}

=======================================================

Stefan



More information about the Gcc-bugs mailing list