template stuff...

Jean-Yves TOUMIT jtoumit@rfv.insa-lyon.fr
Wed Jun 28 12:29:00 GMT 2000


Hello, here's a "simple" bug about template functions.

gcc version :
gcc-2.95.2-7mdk

My box is a RedHat 6.1 with glibc upgraded to glibc-2.1.2-11 on an Athlon 750.

The source code :
class A
{
};

class B
{
public:
	void a(const A & a) { b(a); }
	template <class T> void b(const T & t) {}
};

int main(void)
{
	return 0;
}

The code that caused the error is far larger than that but the error is still
there with this 15-lines code.
Here's the output of gcc :
[jtoumit@rfv-pc28 tests]$ g++ buggcc.cpp 
buggcc.cpp: In method `void B::b<A>(const A &)':
buggcc.cpp:8:   instantiated from here
buggcc.cpp:9: Internal compiler error.
buggcc.cpp:9: Please submit a full bug report.
buggcc.cpp:9: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.

Replacing the "b(a)" by "b<A>(a)" doesn't change anything at all.
Moving the "a" function outside the class fixes the problem (even if it's declared "inline", which
is even more surprising... :-) )... Even simply inverting the declaration order of "a" and "b"
fixes this!... So it must not be *that* serious... :-)

Thanks for the compiler, anyway, it's the one with not so many bugs! ;-)

-- 
Jean-Yves TOUMIT
mailto:Jean-Yves.Toumit@insalien.org
http://rfv.insa-lyon.fr/~jtoumit
ICQ:36936256


More information about the Gcc-bugs mailing list