probably bug in egcs-c++

Maciej Pietka
Mon Aug 10 04:33:00 GMT 1998

// Hello.
// My brave new egcs compiler just crashed and asked me to "submit
// a full bug report" to you, because he didn't like my C++ code ;)
// Here's the story:
// I use a template class in my code, and one of its methods returns
// something of a template type. By mistake, I define that method
// outside of a template without explicitly giving a `template<..>'
// prefix. This is a parse error, and compiler warns me about it.
// But then in the line just before that one I put a (correct)
// definition of constructor or some other method belonging to the
// same class. Now there is no `syntax error' message, but compiler
// crashes with `internal compiler error' instead.

// And here's the source:

template<class T> class X {
  T f();
// here comes something from inside `X', e.g. constructor:
template<class T> X<T>::X() {}

T X::f() {}             // line with a syntax error


// That's all. I think that compiler should tell something about
// `syntax error' in the above line, but it crashes with
// `Internal compiler error' message instead.

// I use RedHat Linux 5.1 on a Pentium box.
// `g++ --version' shows the following:
// egcs-2.90.27 980315 (egcs-1.0.2 release)
// My egcs compiler comes from RedHat 5.1 distribution and it was 
// compiled from their source without modifications.
// Program was compiled with -c flag: % g++ -c
// I've tried also g++ on SPARC/Solaris 2.5 and it works
// normal, i.e. returns `parse error'.

// Maciej Pietka <>

More information about the Gcc-bugs mailing list