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)
131
131
FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
132
132
FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
133
133
FEATURE(objc_fixed_enum, LangOpts.ObjC)
134
+ FEATURE(c_fixed_enum, true )
134
135
FEATURE(objc_instancetype, LangOpts.ObjC)
135
136
FEATURE(objc_kindof, LangOpts.ObjC)
136
137
FEATURE(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];
121
121
enum Color { Red , Green , Blue }; // expected-note{{previous use is here}}
122
122
typedef struct Color NewColor ; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}
123
123
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
+
124
135
// PR28903
125
136
// In C it is valid to define tags inside enums.
126
137
struct PR28903 {
@@ -174,6 +185,7 @@ enum IncOverflow {
174
185
V3 // pre-c23-warning {{incremented enumerator value which exceeds the range of 'int' is a C23 extension}}
175
186
};
176
187
188
+
177
189
#if __STDC_VERSION__ >= 202311L
178
190
// FIXME: GCC picks __uint128_t as the underlying type for the enumeration
179
191
// value and Clang picks unsigned long long.
You can’t perform that action at this time.
0 commit comments