The following invalid code snippet triggers an ICE on mainline and the
4.3 branch:

====================================================
struct A
{
  A(const A&);
};

struct B
{
  operator A&();
};

void foo(const B& b)
{
  const A a = b;
}
====================================================

bug.cc: In function 'void foo(const B&)':
bug.cc:13: error: passing 'const B' as 'this' argument of 'B::operator A&()'
discards qualifiers
bug.cc:13: error: invalid conversion from 'A' to 'A'
bug.cc:13: internal compiler error: in ocp_convert, at cp/cvt.c:627
Please submit a full bug report, [etc.]

This is a regression on the 4.3 branch as 4.3.0 didn't crash.

Note, that the error message "invalid conversion from 'A' to 'A'" isn't
really helpful.


-- 
           Summary: [4.3/4.4 regression] ICE with invalid conversion
           Product: gcc
           Version: 4.4.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=36407

Reply via email to