PR tree-optimization/81627
[official-gcc.git] / gcc / testsuite / gcc.dg / nested-redef-1.c
blobf9326086e304770b11a7da4b2ea70090ef39fa85
1 /* Test diagnosis of nested tag redefinitions. */
2 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
3 /* { dg-do compile } */
4 /* { dg-options "" } */
6 struct s0 {
7 struct s0 { int a; } x; /* { dg-error "nested redefinition of 'struct s0'" } */
8 };
10 struct s1 {
11 const struct s1 { int b; } x; /* { dg-error "nested redefinition of 'struct s1'" } */
14 struct s2 {
15 struct s2 { int c; } *x; /* { dg-error "nested redefinition of 'struct s2'" } */
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;
26 struct s6;
27 struct s6 { struct s6 *p; };
29 union u0 {
30 union u0 { int c; } *x; /* { dg-error "nested redefinition of 'union u0'" } */
33 enum e0 {
34 E0 = sizeof(enum e0 { E1 }) /* { dg-error "nested redefinition of 'enum e0'" } */
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 } */
43 enum e3;
44 enum e3 { E4 = 0 };