Error compiling templates
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Mon Aug 30 02:06:00 GMT 1999
> I am hoping you can help me on a compilation problem. I have implemented
> specialized template functions but got compilation errors (first time I've
> seen this; nevertheless I am confident that my implementations are correct.)
Thanks for your bug report. Your implementations are not correct. In
C++, you must define a specialization before you use it for the first
time; you didn't.
In Truck2.h, you have the field
Auto<Truck, Nissan> _nissan;
which leads to the instantiation of the class Auto<Truck,
Nissan>. Later, you define a specialization. The compiler now
complains that you cannot declare a specialization after the template
was already instantiated. When you fix this, the error goes away.
Hope this helps,
Martin
More information about the Gcc-bugs
mailing list