[Bug c++/14379] New: ICE in tsubst with declaring then defining a member template
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 2 05:55:00 GMT 2004
This little gem (I believe it is valid, but am not quite sure -- icc
accepts it at least)
--------------------
template <int N> struct X {
template <typename T> void f(T);
};
// declare and define specialization
template <> template <typename T> void X<1>::f (T);
template <> template <typename T> void X<1>::f (T) {}
// instantiate it
template void X<1>::f(int);
---------------------
ICEs everything we have, although 2.95 is a little more graceful at
least giving some kind of (bogus) error before:
g/x> /home/bangerth/bin/gcc-2.95.3/bin/c++ -c x.cc
x.cc:6: template parameters specified in specialization
x.cc:6: no `void X<1>::f(T)' member function declared in class `X<1>'
x.cc:6: must specialize `struct X<1>' before defining member `void
X<1>::f<T>(T)
'
x.cc:6: confused by earlier errors, bailing out
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc
x.cc: In member function `void X<N>::f(T) [with T = int, int N = 1]':
x.cc:10: instantiated from here
x.cc:2: internal compiler error: in tsubst, at cp/pt.c:6769
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc
x.cc: In member function `void X<N>::f(T) [with T = int, int N = 1]':
x.cc:10: instantiated from here
x.cc:7: internal compiler error: in tsubst, at cp/pt.c:6735
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc
x.cc: In member function `void X<N>::f(T) [with T = int, int N = 1]':
x.cc:10: instantiated from here
x.cc:7: internal compiler error: in tsubst, at cp/pt.c:6737
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
The problem is with the declaration of the specialization. If I omit it,
then the ICE goes away.
W.
--
Summary: ICE in tsubst with declaring then defining a member
template
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14379
More information about the Gcc-bugs
mailing list