Skip to content

Commit 8722c53

Browse files
author
Aidan
committed
fixed enum.c typed enum logic
1 parent 53ba18d commit 8722c53

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

clang/test/Sema/enum.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ typedef struct Color NewColor; // expected-error {{use of 'Color' with tag type
123123

124124
// Enumerations with a fixed underlying type.
125125
// https://github.com/llvm/llvm-project/issues/116880
126-
#if __STDC_VERSION__ >= 202311L
126+
#if __STDC_VERSION__ >= 202311L && !__has_extension(c_fixed_enum)
127+
#error c_fixed_enum should be set in C23 mode
128+
#elif __STDC_VERSION__ >= 202311L
127129
typedef enum : unsigned char { Pink, Black, Cyan } Color;
128130
#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+
typedef enum : unsigned char { Pink, Black, Cyan } Color; // pre-c23-warning {{enumeration types with a fixed underlying type are a C23 extension}}
131132
#endif
132133

133134
// PR28903

0 commit comments

Comments
 (0)