(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
nested-redef-1.c
       1  /* Test diagnosis of nested tag redefinitions.  */
       2  /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
       3  /* { dg-do compile } */
       4  /* { dg-options "" } */
       5  
       6  struct s0 {
       7    struct s0 { int a; } x; /* { dg-error "nested redefinition of 'struct s0'" } */
       8  };
       9  
      10  struct s1 {
      11    const struct s1 { int b; } x; /* { dg-error "nested redefinition of 'struct s1'" } */
      12  };
      13  
      14  struct s2 {
      15    struct s2 { int c; } *x; /* { dg-error "nested redefinition of 'struct s2'" } */
      16  };
      17  
      18  struct s3 {
      19    struct s4 {
      20      struct s5 {
      21        struct s3 { int a; } **x; /* { dg-error "nested redefinition of 'struct s3'" } */
      22      } y;
      23    } z;
      24  };
      25  
      26  struct s6;
      27  struct s6 { struct s6 *p; };
      28  
      29  union u0 {
      30    union u0 { int c; } *x; /* { dg-error "nested redefinition of 'union u0'" } */
      31  };
      32  
      33  enum e0 {
      34    E0 = sizeof(enum e0 { E1 }) /* { dg-error "nested redefinition of 'enum e0'" } */
      35  };
      36  
      37  enum e1 {
      38    E2 = sizeof(enum e2 { E2 }), /* { dg-error "redeclaration of enumerator 'E2'" } */
      39    /* { dg-message "note: previous definition" "previous E2" { target *-*-* } .-1 } */
      40    E3
      41  };
      42  
      43  enum e3;
      44  enum e3 { E4 = 0 };