(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
c11-anon-struct-1.c
       1  /* Test for anonymous structures and unions in C11.  */
       2  /* { dg-do compile } */
       3  /* { dg-options "-std=c11 -pedantic-errors" } */
       4  
       5  #include <stddef.h>
       6  
       7  struct s1
       8  {
       9    int a;
      10    union
      11    {
      12      int i;
      13    };
      14    struct
      15    {
      16      int b;
      17    };
      18  };
      19  
      20  union u1
      21  {
      22    int b;
      23    struct
      24    {
      25      int i;
      26    };
      27    union
      28    {
      29      int c;
      30    };
      31  };
      32  
      33  struct s2
      34  {
      35    struct
      36    {
      37      int a;
      38    };
      39  };
      40  
      41  struct s3
      42  {
      43    union
      44    {
      45      int i;
      46    };
      47  };
      48  
      49  struct s4
      50  {
      51    struct
      52    {
      53      int i;
      54    };
      55    int a[];
      56  };
      57  
      58  struct s1 x =
      59    {
      60      .b = 1,
      61      .i = 2,
      62      .a = 3
      63    };
      64  
      65  int o = offsetof (struct s1, i);
      66  
      67  void
      68  f (void)
      69  {
      70    x.i = 3;
      71    (&x)->i = 4;
      72  }