bug in egcs-1.1.2 compiling C++ code on linux/x86 - nested classes in template class partial specialization
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Sat Jul 31 23:33:00 GMT 1999
> Compilation of the following (legal C++) code results in a bogus error
> message ...
[...]
> BTW, is there any chance that this bug is fixed in gcc-2.95?
The compiler still crashes, but I think the program is ill-formed. The
compiler now says:
foo.cc:2: declaration of `class T1'
foo.cc:1: shadows template parm `class T1'
foo.cc:2: declaration of `class T2'
foo.cc:1: shadows template parm `class T2'
foo.cc:3: too many template parameter lists in declaration of `foo'
foo.cc: In function `int main()':
foo.cc:20: Internal compiler error in `assign_stack_temp_for_type', at function.c:937
I believe the program is illegal according to 14.6.1, [temp.local]/4:
# A templateÃÂparameter shall not be redeclared within its scope
# (including nested scopes).
However, this is exactly what happens:
template <class T1, class T2>// template class foo
template <class T1, class T2>
class foo {
};
I just noticed that the preprocessed code differs; g++ 2.95 will
process that one just fine.
Regards,
Martin
More information about the Gcc-bugs
mailing list