c++/9436: passing a class template followed by a template value of this class

Giovanni Bajo giovannibajo@libero.it
Fri Jan 24 19:26:00 GMT 2003


The following reply was made to PR c++/9436; it has been noted by GNATS.

From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
	<gcc-bugs@gcc.gnu.org>,
	<nobody@gcc.gnu.org>,
	<gcc-prs@gcc.gnu.org>,
	<dfredoui@irisa.fr>
Cc:  
Subject: Re: c++/9436: passing a class template followed by a template value of this class
Date: Fri, 24 Jan 2003 20:18:14 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
 r=9436
 
 Slightly reduced testcase:
 -------------------------------
 template <typename T, int P = int()>
 struct A {};
 
 template <typename T>
 void foo(A<T> ) {}
 
 void bar(void)
 {
  A<char> a;
  foo(a);
 }
 -------------------------------
 ice.cpp: In function `void bar()':
 ice.cpp:12: internal error: Segmentation fault
 Please submit a full bug report,
 
 This shows that the bug has nothing to do with the dependency between the
 first parameter and the second (default) parameter. GCC seems to crash
 (segmentation fault) when trying to specialize the foo() function, and the
 problem is that the default (and not explicitally matched) parameter P uses
 a constructor as initializer. If you substitute 'int()' with 0, or you
 explicitally match the full type by declaring the parameter of foo as
 'A<T,0>', the ICE goes away. Not tested on post 3.2, might be fixed with the
 new parser.
 
 Giovanni Bajo
 



More information about the Gcc-prs mailing list