c++/5665: gcc goes into endless loop on bad code
Reichelt
reichelt@igpm.rwth-aachen.de
Tue Feb 12 08:13:00 GMT 2002
Hi,
with gcc 3.1 20020202 (experimental) the code causes an ICE:
[deleted lots of error messages]
calc/fdps.h:865: parse error before `)' token
calc/fdps.h:881: 'db_t' is used as a type, but is not defined as a type.
calc/fdps.h:905: syntax error before `<' token
calc/fdps.h:905: `MSG' was not declared in this scope
calc/fdps.h:905: template argument 1 is invalid
calc/fdps.h:905: tree check: expected class 't', have 'x' (error_mark) in
make_typename_type, at cp/decl.c:5689
Please submit a full bug report, [etc.]
The ICE can be reproduced with the following code snippet:
------------------snip here-----------------
template<class T> class A
{
class B { X foo(); }; // illegal, X is undefined
};
template<class T> X A<T>::B::foo() {}
------------------snip here-----------------
Just compile with "g++ -c" to the the following error message:
bug.cpp:3: parse error before `)' token
bug.cpp:6: syntax error before `<' token
bug.cpp:6: `T' was not declared in this scope
bug.cpp:6: template argument 1 is invalid
bug.cpp:6: tree check: expected class 't', have 'x' (error_mark) in
make_typename_type, at cp/decl.c:5689
Please submit a full bug report, [etc.]
However, this reduced example compiles fine with gcc 3.0.3, i.e.
a correct error message is emitted without ICE.
Greetings,
Volker Reichelt
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5665
More information about the Gcc-bugs
mailing list