This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

probably bug in egcs-c++


// 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 {
public:
  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 buggy.cc
// I've tried also g++ 2.7.2.1 on SPARC/Solaris 2.5 and it works
// normal, i.e. returns `parse error'.

// Maciej Pietka <map@alpha.uwb.edu.pl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]