The following invalid testcase triggers an ICE on trunk (and GCC 4.1.x):

====================================
struct A;

struct B
{
  A a;
};

B b[1] = (B[]) { 0 };
====================================

bug.cc:5:5: error: field 'a' has incomplete type
bug.cc:8:20: error: initializer for 'B' must be brace-enclosed
bug.cc:8:20: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in digest_init_r, at cp/typeck2.c:844
Please submit a full bug report, [etc.]

If one actually defines A, the compiler goes into an infinite loop
(since GCC 4.1.0):

====================================
struct A {};

struct B
{
  A a;
};

B b[1] = (B[]) { 0 };
====================================

bug.cc:8:20: error: initializer for 'A' must be brace-enclosed
bug.cc:8:20: error: initializer for 'A' must be brace-enclosed
bug.cc:8:20: error: initializer for 'A' must be brace-enclosed
[etc.]


-- 
           Summary: [4.3/4.4/4.5 Regression] Trouble with invalid array
                    initialization
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored, compile-
                    time-hog
          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=42058

Reply via email to