Bug report

Alexey Zverovich Alexey.Zverovich@brunel.ac.uk
Fri Dec 31 20:54:00 GMT 1999


Problem summary:
G++ displays 'Internal compiler error' message when trying to
compile code that contains typedef for an array of negative
size within a class template. Within a non-templated class it
correctly diagnoses negative array size.
See below for minimal code needed to reproduce the problem.
I've come across this when implementing some compile-time
assertions for template arguments.

Cheers,
Alex.

----------------------------------------------------------------------
# g++ --version
egcs-2.91.66
----------------------------------------------------------------------
# uname -a
Linux [hostname] 2.2.5-15 #1 Mon Apr 19 23:00:46 EDT 1999 i686 unknown
----------------------------------------------------------------------
Distribution: RedHat 6.0
----------------------------------------------------------------------
Command line: g++ bug.cxx
----------------------------------------------------------------------
Source code:

// bug.cxx
template<int N>
class bug
{
	typedef char fail[-1];
};

----------------------------------------------------------------------
Preprocessed output:

# 1 "bug.cxx"

template<int N>
class bug

	typedef char fail[-1];
};
----------------------------------------------------------------------
Compiler output:
bug.cxx:5: Internal compiler error.
bug.cxx:5: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
bug.cxx:5: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for details.
----------------------------------------------------------------------



More information about the Gcc-bugs mailing list