File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ FEATURE(objc_arc_fields, true)
131131FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
132132FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
133133FEATURE(objc_fixed_enum, LangOpts.ObjC)
134+ FEATURE(c_fixed_enum, true )
134135FEATURE(objc_instancetype, LangOpts.ObjC)
135136FEATURE(objc_kindof, LangOpts.ObjC)
136137FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)
Original file line number Diff line number Diff line change @@ -121,6 +121,17 @@ int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
121121enum Color { Red , Green , Blue }; // expected-note{{previous use is here}}
122122typedef struct Color NewColor ; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}
123123
124+ // Enumerations with a fixed underlying type.
125+ // https://github.com/llvm/llvm-project/issues/116880
126+ #if __STDC_VERSION__ >= 202311L
127+ typedef enum : unsigned char { Pink , Black , Cyan } Color ;
128+ #else
129+ _Static_assert (__has_extension (c_fixed_enum ), "Ensure language extension support for enumerations with a fixed underlying type in <C23" );
130+ typedef enum : unsigned char { Pink , Black , Cyan } Color ; // expected-warning {{enumeration types with a fixed underlying type are a C23 extension}}
131+ #endif
132+
133+
134+
124135// PR28903
125136// In C it is valid to define tags inside enums.
126137struct PR28903 {
@@ -174,6 +185,7 @@ enum IncOverflow {
174185 V3 // pre-c23-warning {{incremented enumerator value which exceeds the range of 'int' is a C23 extension}}
175186};
176187
188+
177189#if __STDC_VERSION__ >= 202311L
178190// FIXME: GCC picks __uint128_t as the underlying type for the enumeration
179191// value and Clang picks unsigned long long.
You can’t perform that action at this time.
0 commit comments