This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9436: passing a class template followed by a template value of this class
- From: "Giovanni Bajo" <giovannibajo at libero dot it>
- To: <gcc-gnats at gcc dot gnu dot org>,<gcc-bugs at gcc dot gnu dot org>,<nobody at gcc dot gnu dot org>,<gcc-prs at gcc dot gnu dot org>,<dfredoui at irisa dot fr>
- Date: Fri, 24 Jan 2003 20:18:14 +0100
- Subject: Re: c++/9436: passing a class template followed by a template value of this class
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