Template bug in gcc 2.95 and 2.95.1?
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Thu Sep 30 19:57:00 GMT 1999
> template class Test <Obj const *>;
> template class Test <const Obj *>;
[...]
> I also tried the Sun C++ compiler and it gives no error.
> Is this a bug of gcc?
No, it is a bug in your code. "Obj const *" and "const Obj *" is
really the same type; you can freely put cv qualifiers before or after
the innermost type. Following the same pattern,
const char *x;
char const *y;
are the same type as well, don't you agree? "char * const z" would be
differently.
Since they are the same type, you get a duplicate instantiation. Now,
it would look like a bug in Sun CC that they don't report
that. However, I believe duplicate instantiations don't need to be
diagnosed.
Regards,
Martin
More information about the Gcc-bugs
mailing list