This is the mail archive of the 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]
Other format: [Raw text]

c++/6730: Crash involving templates when compiling program

>Number:         6730
>Category:       c++
>Synopsis:       Crash involving templates when compiling program
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sun May 19 22:16:00 PDT 2002
>Originator:     Bradley Baetz
>Release:        3.2 20020519 (experimental)
System: Linux tomato.home 2.4.18 #8 Thu Feb 28 22:43:37 EST 2002 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/home/bbaetz/gcc/ --enable-languages=c,c++,treelang --enable-threads=posix --disable-checking
	I was attempting to get the testcase in
to work.

Uncommenting either of the usages of has_subscript_operator in main causes 
a crash:

sub.cpp: In instantiation of `has_subscript_operator<int>':
sub.cpp:13:   instantiated from here
sub.cpp:6: internal error: Segmentation fault

The first line is obviously illegal (a typo I made while I was playing
with the testcase), but I believe that the second should be OK.

template<typename T>
class has_subscript_operator
  template <int> struct helper {};
  template <class U> static int foo( helper<sizeof( &U::operator[] )> * );
  int value() { return 0; };
int main() {
//  return has_subscript_operator<int>::value;
  return has_subscript_operator<int>().value();

	g++ -Wall
Removing the unused template functions (which are unused in this 
example) from the class avoids the crash.

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