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