Internal compiler error in GCC snapshot for syntactically-incorrect input

James A. Bednar jbednar@cs.utexas.edu
Tue Apr 18 21:40:00 GMT 2000


Using the current GCC Online Compiler Submission at
http://www.codesourcery.com/gcc-compile.html on the following code
generates an "Internal compiler error" (see attached):

  template <class T>
  void f(const T& a) { }
  
  T g() { return T(0); }

Obviously, this code is syntactically incorrect, since the type T is
undefined in g(). (I forgot to add another "template <class T>" before
it!)  However, the compiler should handle the problem a little more
gracefully.  The same symptoms occur with egcs-1.1.2, so the problem
has been present at least that long.

Also note that the error message appears to be ill-formed.

Should this code prove useful as a test case, I hereby place it into
the public domain for anyone to use for whatever purpose they see fit.

Jim Bednar

-------------------------------------------------------------------------------
Tue Apr 18 23:33:47 CDT 2000
GCC Output


These are the results of processing your source code with the following
command:

    c++ -x c++ -c [input] 


Exit code: 256

Messages:

    /tmp/@21228.1:4: Internal compiler error.
    /tmp/@21228.1:4: Please submit a full bug report.
    /tmp/@21228.1:4: See 
    /tmp/@21228.1:4: for instructions.



More information about the Gcc-bugs mailing list