1 // RUN: clang-cc %s -fsyntax-only -verify -pedantic
3 B = 42LL << 32, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
6 enum f { a = -2147483648, b = 2147483647 }; // ok.
8 enum g { // too negative
9 c = -2147483649, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
11 enum h { e = -2147483648, // too pos
12 f = 2147483648 // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
16 enum x // expected-warning {{enumeration values exceed range of largest integer}}
17 { y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
18 z = 9223372036854775808ULL }; // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
21 return sizeof(enum e) ;
24 enum gccForwardEnumExtension ve; // expected-warning{{ISO C forbids forward references to 'enum' types}} \
25 // expected-error{{tentative definition has type 'enum gccForwardEnumExtension' that is never completed}} \
26 // expected-note{{forward declaration of 'enum gccForwardEnumExtension'}}
30 ve + i; // expected-error{{invalid operands to binary expression}}
34 union u0; // expected-note {{previous use is here}}
35 enum u0 { U0A }; // expected-error {{use of 'u0' with tag type that does not match previous declaration}}
39 extern enum some_undefined_enum ve2; // expected-warning {{ISO C forbids forward references to 'enum' types}}
42 for (; ve2;) // expected-error {{statement requires expression of scalar type}}
44 (_Bool)ve2; // expected-error {{arithmetic or pointer type is required}}
49 ve2; // expected-warning {{expression result unused}}
53 enum someenum {}; // expected-warning {{use of empty enum extension}}
55 // <rdar://problem/6093889>
56 enum e0 { // expected-note {{previous definition is here}}
57 E0 = sizeof(enum e0 { E1 }), // expected-error {{nested redefinition}}
61 enum { PR3173A, PR3173B = PR3173A+50 };
65 enum xpto; // expected-warning{{ISO C forbids forward references to 'enum' types}}
66 enum xpto; // expected-warning{{ISO C forbids forward references to 'enum' types}}
69 // <rdar://problem/6503878>
70 typedef enum { X = 0 }; // expected-warning{{typedef requires a name}}
73 enum NotYetComplete { // expected-note{{definition of 'enum NotYetComplete' is not complete until the closing '}'}}
74 NYC1 = sizeof(enum NotYetComplete) // expected-error{{invalid application of 'sizeof' to an incomplete type 'enum NotYetComplete'}}
79 enum e1 (*bar)(void); // expected-warning{{ISO C forbids forward references to 'enum' types}}
84 static enum e1 badfunc(struct s1 *q) {