(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wmissing-field-initializers-4.c
       1  /* PR c/82283 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wmissing-field-initializers" } */
       4  
       5  struct a {
       6    int b;
       7  };
       8  
       9  struct c {
      10    struct a d;
      11    int e;
      12  };
      13  
      14  void f (struct c *);
      15  
      16  void
      17  g (void)
      18  {
      19    struct c h = {.d = (struct a){0}}; /* { dg-bogus "missing initializer" } */
      20    f(&h);
      21  }
      22  
      23  struct {
      24    struct {
      25      int a;
      26      int b;
      27    } c[1];
      28  } d = {
      29    .c[0].a = 1,
      30    .c[0].b = 1, /* { dg-bogus "missing initializer" } */
      31  };
      32  
      33  struct test_t {
      34    int value1;
      35    int value2;
      36  };
      37  
      38  struct test_t test[] = {
      39    [0].value1 = 1,
      40    [0].value2 = 2, /* { dg-bogus "missing initializer" } */
      41    [1].value1 = 10,
      42    [1].value2 = 20 /* { dg-bogus "missing initializer" } */
      43  };