[Bug c++/19989] New: Inconsistency with zero-sized arrays

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 16 04:55:00 GMT 2005

The following testcase shows some inconsistency w.r.t zero-size arrays.
Without "-pedantic" we diagnose the array(s) whose dimension is found via
dependent lookup.

template<int> struct A
    static const int i = 0;

template<int N> struct B
    int x[A<N>::i]; // error
    int y[A<0>::i]; // no error since 3.4.0
    int z[0];       // no error

B<0> b;

Depending on the point of view this is rejects-valid or accepts-invalid.
Btw, with "-pedantic" we diagnose all three arrays.

           Summary: Inconsistency with zero-sized arrays
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


More information about the Gcc-bugs mailing list