The following invalid code snippet triggers an ICE since GCC 3.4.0:

===========================================
template<typename> struct A
{
    template<int> void foo()  // missing ;
};

template<> struct A<void>
{
    template<int> void foo();
};

void bar()
{
    A<void> a;
    a.foo<0>();
}
===========================================

bug.cc:4: error: expected initializer before '}' token
bug.cc:6: error: explicit specialization in non-namespace scope 'struct A<
<template-parameter-1-1> >'
bug.cc:6: error: enclosing class templates are not explicitly specialized
bug.cc:6: error: template parameters not used in partial specialization:
bug.cc:6: error:         '<template-parameter-1-1>'
bug.cc:15: error: expected `}' at end of input
bug.cc: In member function 'void A< <template-parameter-1-1> >::bar()':
bug.cc:14: internal compiler error: in retrieve_specialization, at cp/pt.c:819
Please submit a full bug report, [etc.]


-- 
           Summary: [4.0/4.1/4.2 regression] ICE with broken specialization
           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=28301

Reply via email to