main-trunck-g++: a template regression
Max Lawson
mlawson@drfmc.ceng.cea.fr
Sun Mar 8 08:09:00 GMT 1998
template<class P> struct B
{
template<class T> void f(T& t) { t = T(); }
};
enum ptype { t1, t2};
struct D : public B<ptype>
{
void g(double& d) { f(d); }
};
D d;
/*
main-trunk-g++ regression:
main-trunk-g++ can't compile the above testcase, which IMHO is correct.
It compiles compiles fine with the pre-release version.
the problem occurs because the base class B is a template: it doesn't if
B is not a template class.
$ g++ -c bug.cc
bug.cc: In method `void D::g(double &)':
bug.cc:10: no matching function for call to `D::f (double &)'
bug.cc:3: candidates are: B<ptype>::f<double>(T &)
$ g++ -v
Reading specs from /usr/local/egcs-cvs-980307-18h00-MET/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.91.12/specs
gcc version egcs-2.91.12 980302 (gcc-2.8.0 release)
Regards, Max.
P.S. with the snapshot I'm using, I can't no more take the reference of a
temporary: is this behaviour coming from the standard ? Thanx.
*/
More information about the Gcc-bugs
mailing list