This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
template stuff...
- To: gcc-bugs at gcc dot gnu dot org
- Subject: template stuff...
- From: Jean-Yves TOUMIT <jtoumit at rfv dot insa-lyon dot fr>
- Date: Wed, 28 Jun 2000 21:29:20 +0200
- Organization: INSA de Lyon
- Reply-To: Jean-Yves dot Toumit at insalien dot org
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