specific order of template specialization causes ICE
>Submitter-Id: net
>Originator: Jeremy H. Brown
>Organization: Bluefin Robotics Corp.
>Confidential: no
>Synopsis: specific order of template specialization causes ICE
>Severity: serious
>Priority: low
>Category: c++
>Class: ice-on-legal-code
>Release: 3.3.2 (Debian) (Debian testing/unstable)
>Environment:
System: Linux razorfish 2.4.22-1-686 #6 Sat Oct 4 14:09:08 EST 2003 i686 GNU/Linux
Architecture: i686
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
>Description:
Certain orders of partial specialization cause the compiler
to emit an ICE:
breakgcc.cc:14: internal compiler error: in register_specialization, at cp/pt.c
:968
>How-To-Repeat:
The following code demonstrates the problem, saved as breakgcc.ii and
compiled with
g++ -Wall breakgcc.ii
Switching the order of the two specializations makes the problem go away.
------------------------------------------------------------
# 1 "breakgcc.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "breakgcc.cc"
template <class foo>
class bar {
public:
template <class baz>
int func(baz *x);
};
template <>
template <class baz>
int bar<double>::func(baz *x) { return 5;}
template <>
template <>
int bar<double>::func(int *x) { return 5;}
------------------------------------------------------------
>Fix:
Workaround: Re-order the specializations.
Reply to: