c++/6446: ICE specialising template constructor

Claudius Link Claudius.Link@mathematik.uni-freiburg.de
Thu Apr 25 03:36:00 GMT 2002


>Number:         6446
>Category:       c++
>Synopsis:       Template specialisation causes internal error
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 25 02:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Claudius Link
>Release:        3.0.4 (Debian testing/unstable)
>Organization:
University Freiburg, Institute for Applied Mathematics
>Environment:
System: Linux zaphod 2.4.18 #1 SMP Tue Apr 16 19:32:36 CEST 2002 i686 unknown
Architecture: i686

	
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
First of all, I am not sure if the code is really leagal. But a least I get
an ICE for sure.

If you create a templcate class without specifying a (default) constructor but
you provide later a specialised (default) constructor. I get an ICE.

The same applies for 
	GNU C++ version 2.95.4 20011002 (Debian prerelease) (i386-linux)
	compiled by GNU C version 2.95.4 20011002 (Debian prerelease).

>How-To-Repeat:
# 1 "tempspec.cc"
template<class T>
struct Foo
{

};

Foo<int>::Foo()
{
}

void bar()
{
        Foo<int> f;
}
>Fix:
Pretty easy. Just add the "prototype" of the constructor in the
unspecialised template declaration.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list