1 /* Test for uses of incomplete enum variables: should be allowed just
2 when incomplete structs are allowed. PR 32295. */
3 /* Origin: Joseph Myers <joseph@codesourcery.com> */
4 /* { dg-do compile } */
5 /* { dg-options "" } */
6
7 extern enum e ve;
8 extern struct s vs;
9 void *p;
10
11 int
f0(int i)12 f0 (int i)
13 {
14 ve; /* { dg-error "incomplete" } */
15 vs; /* { dg-error "incomplete" } */
16 (void) ve;
17 (void) vs;
18 (void) (i ? ve : ve); /* { dg-error "incomplete" } */
19 (void) (i ? vs : vs); /* { dg-error "incomplete" } */
20 (void) (ve = ve); /* { dg-error "incomplete" } */
21 (void) (vs = vs); /* { dg-error "incomplete" } */
22 (void) ve, (void) ve;
23 (void) vs, (void) vs;
24 p = &ve;
25 p = &vs;
26 (void) sizeof (ve); /* { dg-error "incomplete" } */
27 (void) sizeof (vs); /* { dg-error "incomplete" } */
28 typeof (ve) *pe;
29 typeof (vs) *ps;
30 /* ??? alignof should probably not be accepted here. */
31 (void) __alignof (ve);
32 (void) __alignof (vs);
33 (void) (ve + i); /* { dg-error "incomplete" } */
34 (void) (i * ve); /* { dg-error "incomplete" } */
35 (void) (i / ve); /* { dg-error "incomplete" } */
36 (void) (ve - i); /* { dg-error "incomplete" } */
37 (void) (ve << i); /* { dg-error "incomplete" } */
38 (void) (i >> ve); /* { dg-error "incomplete" } */
39 (void) (ve < i); /* { dg-error "incomplete" } */
40 (void) (ve <= i); /* { dg-error "incomplete" } */
41 (void) (i > ve); /* { dg-error "incomplete" } */
42 (void) (i >= ve); /* { dg-error "incomplete" } */
43 (void) (ve == i); /* { dg-error "incomplete" } */
44 (void) (i != ve); /* { dg-error "incomplete" } */
45 (void) (ve & i); /* { dg-error "incomplete" } */
46 (void) (ve ^ i); /* { dg-error "incomplete" } */
47 (void) (i | ve); /* { dg-error "incomplete" } */
48 (void) (i && ve); /* { dg-error "incomplete" } */
49 (void) (ve || i); /* { dg-error "incomplete" } */
50 (void) -ve; /* { dg-error "incomplete" } */
51 (void) +ve; /* { dg-error "incomplete" } */
52 (void) ~ve; /* { dg-error "incomplete" } */
53 (void) !ve; /* { dg-error "incomplete" } */
54 (void) --ve; /* { dg-error "incomplete" } */
55 (void) ++ve; /* { dg-error "incomplete" } */
56 (void) ve--; /* { dg-error "incomplete" } */
57 (void) ve++; /* { dg-error "incomplete" } */
58 i = ve; /* { dg-error "incomplete" } */
59 i *= ve; /* { dg-error "incomplete" } */
60 i /= ve; /* { dg-error "incomplete" } */
61 i %= ve; /* { dg-error "incomplete" } */
62 i += ve; /* { dg-error "incomplete" } */
63 i -= ve; /* { dg-error "incomplete" } */
64 i <<= ve; /* { dg-error "incomplete" } */
65 i >>= ve; /* { dg-error "incomplete" } */
66 i &= ve; /* { dg-error "incomplete" } */
67 i ^= ve; /* { dg-error "incomplete" } */
68 i |= ve; /* { dg-error "incomplete" } */
69 (void) (ve ? 1 : 1); /* { dg-error "incomplete" } */
70 (void) (int) ve; /* { dg-error "incomplete" } */
71 f0 (ve); /* { dg-error "incomplete" } */
72 if (ve) /* { dg-error "incomplete" } */
73 ;
74 do
75 ;
76 while (ve); /* { dg-error "incomplete" } */
77 while (ve) /* { dg-error "incomplete" } */
78 ;
79 _Bool b = ve; /* { dg-error "incomplete" } */
80 float f = ve; /* { dg-error "incomplete" } */
81 switch (ve) /* { dg-error "incomplete" } */
82 ;
83 for (; ve;) /* { dg-error "incomplete" } */
84 ;
85 return ve; /* { dg-error "incomplete" } */
86 }
87