[Bug c++/25638] New: [4.0/4.1/4.2 regression] ICE on templated destructor as friend

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 2 13:57:00 GMT 2006


The following invalid code snippet causes an ICE since GCC 4.0.0:

========================================
struct A { ~A(); };

struct B : A
{
    template<int> friend A::~A();
};
========================================

bug.cc:5: error: prototype for 'A::~A()' does not match any in class 'A'
bug.cc:1: error: candidate is: A::~A()
bug.cc:4: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'overload'  in add_implicitly_declared_members,
at cp/class.c:2525
Please submit a full bug report, [etc.]

In addition, the error message before the ICE could be better:
1) A destructor can never be a template. This is not mentioned here.
2) We only print 'A::~A()' as the prototype. We should probably print
   that we have a template here. Otherwise there's no difference to the
   rejected candidate.


-- 
           Summary: [4.0/4.1/4.2 regression] ICE on templated destructor as
                    friend
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, diagnostic,
                    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=25638




More information about the Gcc-bugs mailing list