The C++ frontend ICEs on the following invalid code snippet since GCC 3.4.0:
==================================================
template<int> struct A
{
template<template<void> class> struct B {};
template<void> struct C;
B<C> b;
};
A<0> a;
==================================================
bugB.cc:3: error: 'void' is not a valid type for a template constant parameter
bugB.cc:4: error: 'void' is not a valid type for a template constant parameter
bugB.cc: In instantiation of 'A<0>':
bugB.cc:8: instantiated from here
bugB.cc:3: error: 'void' is not a valid type for a template constant parameter
bugB.cc:4: error: 'void' is not a valid type for a template constant parameter
bugB.cc:4: error: 'void' is not a valid type for a template constant parameter
bugB.cc:5: internal compiler error: in coerce_template_parms, at cp/pt.c:4042
Please submit a full bug report, [etc.]
With GCC 3.3.3 - 3.3.6 we got sensible error messages.
Before GCC 3.3.3 the compiler entered an infinite loop.
--
Summary: [4.0/4.1/4.2 regression] ICE with invalid template-
template-parameter
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code, error-recovery, monitored
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27425