2008-01-25 Douglas Gregor <doug.gregor@gmail.com>
[official-gcc.git] / gcc / testsuite / gcc.dg / nested-redef-1.c
blobacc961dac234a7e9e99322822afcf57a9aa12d79
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-error "previous definition" "previous E2" { target *-*-* } 38 } */
43 enum e3;
44 enum e3 { E4 = 0 };