struct Foo { int i; char a[]; } foo = { 1, "" };   // No warning
struct Bar { int i; char a[]; } bar = { 1, {0} };  // Warning

Line 1 passes -pedantic, but C99 6.7.2.1p16 says it is invalid:
Flexible array members are ignored except with ',', '->',
and for aligning the size of the struct.

Related: Bug 20407: g++ does reject it, even without -pedantic.


-- 
           Summary: -pedantic accepts flexible array member = "string"
                    initialization
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: h dot b dot furuseth at usit dot uio dot no
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37481

Reply via email to