1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
3
4 struct s1 { int f; };
5 typedef int s2;
6 void
f1()7 f1 ()
8 {
9 typedef int s1;
10 struct s2 { int f; };
11 }
12
13 struct s3 { int f; };
14 typedef struct s3 s3;
15
16 typedef struct s4 s4;
17 struct s4 { int f; };
18
19 struct s5 { int f; }; /* { dg-message "note: originally defined here" } */
20 typedef int s5; /* { dg-warning "invalid in C\[+\]\[+\]" } */
21
22 typedef int s6; /* { dg-message "note: originally defined here" } */
23 struct s6 { int f; }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
24
25 void
f2()26 f2 ()
27 {
28 struct s7 { int f; }; /* { dg-message "note: originally defined here" } */
29 typedef int s7; /* { dg-warning "invalid in C\[+\]\[+\]" } */
30
31 typedef int s8; /* { dg-message "note: originally defined here" } */
32 struct s8 { int f; }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
33
34 struct s9 { int f; };
35 { typedef int s9; }
36
37 typedef int s10;
38 { struct s10 { int f; }; }
39 }
40
41 enum e1 { A };
42 typedef int e2;
43 void
f3()44 f3 ()
45 {
46 typedef int e1;
47 enum e2 { B };
48 }
49
50 enum e3 { C };
51 typedef enum e3 e3;
52
53 enum e5 { E }; /* { dg-message "note: originally defined here" } */
54 typedef int e5; /* { dg-warning "invalid in C\[+\]\[+\]" } */
55
56 typedef int e6; /* { dg-message "note: originally defined here" } */
57 enum e6 { F }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
58
59 void
f4()60 f4 ()
61 {
62 enum e7 { G }; /* { dg-message "note: originally defined here" } */
63 typedef int e7; /* { dg-warning "invalid in C\[+\]\[+\]" } */
64
65 typedef int e8; /* { dg-message "note: originally defined here" } */
66 enum e8 { H }; /* { dg-warning "invalid in C\[+\]\[+\]" } */
67
68 enum e9 { I };
69 { typedef int e9; }
70
71 typedef int e10;
72 { enum e10 { J }; }
73 }
74