https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856

            Bug ID: 64856
           Summary: Initializing struct not accepted in gnu99
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org

struct A {
  unsigned long b;
};

struct B {
  struct A c[2];
};

struct B d = { .c = { [0 ... 1] = (struct A){ .b = -1UL } } };

$ ./cc1 -quiet j.c -std=gnu90
$ ./cc1 -quiet j.c -std=gnu99
j.c:9:35: error: initializer element is not constant
 struct B d = { .c = { [0 ... 1] = (struct A){ .b = -1UL } } };
                                   ^
j.c:9:35: note: (near initialization for ‘d.c[0]’)
j.c:9:35: error: initializer element is not constant
j.c:9:35: note: (near initialization for ‘d.c[1]’)

This is bad with gnu11 as a default.

Reply via email to