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

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

struct B : A {};
struct C : A {};

void bar()
{
  B().C::foo<0>();
}
===============================

bug.cc: In function 'void bar()':
bug.cc:11: internal compiler error: in build_base_path, at cp/class.c:272
Please submit a full bug report, [etc.]

Before GCC 3.4.0 we generated a correct diagnostic:
bug.cc:11: error: type `C' is not a base type for type `B'

GCC 3.4.0 - 4.1.1 wrongly accepted the code.


-- 
           Summary: [4.1/4.2/4.3 regression] ICE with invalid base type for
                    class member
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, 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=34059

Reply via email to