1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify=expected,c -xc %s
5 #if !__has_feature(objc_fixed_enum)
6 # error Enumerations with a fixed underlying type are not supported
10 #if !__has_extension(cxx_fixed_enum)
11 # error Enumerations with a fixed underlying type are not supported
16 typedef enum : Integer { Enumerator1, Enumerator2 } Enumeration;
18 int array[sizeof(Enumeration) == sizeof(long)? 1 : -1];
21 enum Color { Red, Green, Blue };
26 enum Other : Integer field2; // c-error {{only permitted as a standalone}}
27 enum Other : Integer field3 : 4; // c-error {{only permitted as a standalone}}
28 enum : Integer { Blah, Blarg } field4 : 4;
33 Enumeration e = value;
36 typedef enum : long { Foo } IntegerEnum;
37 int arr[(sizeof(__typeof__(Foo)) == sizeof(__typeof__(IntegerEnum)))? 1 : -1];
38 int arr1[(sizeof(__typeof__(Foo)) == sizeof(__typeof__(long)))? 1 : -1];
39 int arr2[(sizeof(__typeof__(IntegerEnum)) == sizeof(__typeof__(long)))? 1 : -1];
41 typedef enum : long long { Bar = -1 } LongLongEnum;
42 int arr3[(long long)Bar == (long long)-1 ? 1 : -1];
44 typedef enum : Integer { BaseElem } BaseEnum;
45 typedef enum : BaseEnum { DerivedElem } DerivedEnum; // expected-error {{non-integral type 'BaseEnum' is an invalid underlying type}}