13797 – [3.3 regression] ICE on invalid template parameter (original) (raw)

Comment 3 Wolfgang Bangerth 2004-01-21 20:50:56 UTC

Confirmed. An ice-after-error. I don't have the time to reduce this at the moment, though, so I'll leave it to others.

W.

Comment 4 Volker Reichelt 2004-01-22 21:14:28 UTC

Here's a reduced testcase.

======================================= template struct A { typedef A<0> B; template struct B {}; };

A<0> a;

With gcc 3.4.0 20031229 I get

PR13797.cc:4: error: struct A<0>' is not a valid type for a template constant parameter [PR13797](show%5Fbug.cgi?id=13797 "RESOLVED FIXED - [3.3 regression] ICE on invalid template parameter").cc:4: error: declaration of template<int > template<void > struct A< >::B' PR13797.cc:3: error: conflicts with previous declaration typedef struct A<0> A<<anonymous> >::B' [PR13797](show%5Fbug.cgi?id=13797 "RESOLVED FIXED - [3.3 regression] ICE on invalid template parameter").cc: In instantiation of A<0>': PR13797.cc:7: instantiated from here PR13797.cc:3: error: `void' is not a valid type for a template constant parameter PR13797.cc:3: internal compiler error: in instantiate_class_template, at cp/pt.c:5384 Please submit a full bug report,

If I replace line 4 with

template <B> struct C {};

I get:

PR13797.cc:4: error: struct A<0>' is not a valid type for a template constant parameter [PR13797](show%5Fbug.cgi?id=13797 "RESOLVED FIXED - [3.3 regression] ICE on invalid template parameter").cc: In instantiation of A<0>': PR13797.cc:7: instantiated from here PR13797.cc:4: error: `void' is not a valid type for a template constant parameter PR13797.cc:4: internal compiler error: tree check: expected record_type, have error_mark in tsubst_decl, at cp/pt.c:5917 Please submit a full bug report,

GCC 2.95.3 issues a correct error message (thus we have a regression), 3.0 - 3.3.x go into an endless loop outputting the same error message over and over again.

Comment 8 Kriang Lerdsuwanakij 2004-01-25 14:40:05 UTC

For 3.3 branch, a patch is available

http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02732.html

however it only fixes the ICE exposed in the reduced testcases.

The original testSeries.ii is preprocessed with GCC 3.4 libstdc++ headers that GCC 3.3 refuses to compile and produces additional ICE. This ICE is probably treated as won't fix.

Comment 10 Kriang Lerdsuwanakij 2004-01-25 15:12:44 UTC

I'm closing this as fixed.