[clang] [clang][sema] (PR #117507)

Justin Fargnoli via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 24 13:10:30 PST 2024


================
@@ -121,6 +121,17 @@ int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
 enum Color { Red, Green, Blue }; // expected-note{{previous use is here}}
 typedef struct Color NewColor; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}
 
+// Enumerations with a fixed underlying type. 
+// https://github.com/llvm/llvm-project/issues/116880
+#if __STDC_VERSION__ >= 202311L
+    typedef enum : unsigned char { Pink, Black, Cyan } Color;
+#else
+    _Static_assert(__has_extension(c_fixed_enum), "Ensure language extension support for enumerations with a fixed underlying type in <C23");
+    typedef enum : unsigned char { Pink, Black, Cyan } Color; // expected-warning {{enumeration types with a fixed underlying type are a C23 extension}}
+#endif
+
+
----------------
justinfargnoli wrote:

Delete these lines

https://github.com/llvm/llvm-project/pull/117507


More information about the cfe-commits mailing list