boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

241-init-brace-elision-struct-array.c (416B)


      1 // tests/cc/241-init-brace-elision-struct-array.c — brace elision for
      2 // nested aggregate initializers. C99 §6.7.8 ¶22: when an inner
      3 // aggregate has no enclosing brace, items are drawn from the parent
      4 // list deep enough to fill it.
      5 struct S { int a; int b; };
      6 int main(void) {
      7     struct S arr[2] = { 1, 2, 3, 4 }; /* no inner braces */
      8     return arr[0].a + arr[0].b + arr[1].a + arr[1].b; /* expect 10 */
      9 }