[Bug c++/31132] New: [4.1/4.2/4.3 regression] ICE on inconsistent friend declaration

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Mar 11 11:56:00 GMT 2007


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

=====================================
template<typename T> class A
{
  static int i;
  friend int T::foo();
};

struct B
{
  void foo() { A<B>::i; }
};
=====================================

bug.cc: In instantiation of 'A<B>':
bug.cc:9:   instantiated from here
bug.cc:4: error: prototype for 'int B::foo()' does not match any in class 'B'
bug.cc:9: error: candidate is: void B::foo()
bug.cc:4: error: 'int B::foo()' cannot be overloaded
bug.cc:9: error: with 'void B::foo()'
bug.cc: In member function 'void B::foo()':
bug.cc:9: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have template_type_parm in template_class_depth,
at cp/pt.c:295
Please submit a full bug report, [etc.]


-- 
           Summary: [4.1/4.2/4.3 regression] ICE on inconsistent friend
                    declaration
           Product: gcc
           Version: 4.3.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=31132



More information about the Gcc-bugs mailing list