The following invalid code snippet causes an ICE since GCC 3.0:
===================================
template<int> struct A
{
template<void> friend class X;
};
A<0> a;
===================================
bug.cc:3: error: 'void' is not a valid type for a template constant parameter
bug.cc: In instantiation of 'A<0>':
bug.cc:6: instantiated from here
bug.cc:3: error: 'void' is not a valid type for a template constant parameter
bug.cc:3: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'error_mark' in tsubst_friend_class, at
cp/pt.c:5443
Please submit a full bug report, [etc.]
GCC 2.95.3 wrongly accepted the code.
--
Summary: ICE on broken templated friend
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=27496