================ @@ -121,6 +121,16 @@ 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 && !__has_feature(c_fixed_enum) + #error c_fixed_enum should be set a feature in C23 mode +#elif __STDC_VERSION__ < 202311L && !__has_extension(c_fixed_enum) + #error c_fixed_enum should be a language extension in <C23 mode +#else + typedef enum : unsigned char { Pink, Black, Cyan } Color; // pre-c23-warning {{enumeration types with a fixed underlying type are a C23 extension}} +#endif ---------------- AidanGoldfarb wrote:
Updated. I chose to include `typedef enum : unsigned char { Pink, Black, Cyan } Color; // pre-c23-warning {{enumeration types with a fixed underlying type are a C23 extension}}` in `enum.c`, as I think we want to test for both the behavior of `__has_feature()` and `__has_extension()` as well as the actual definition of a typed enum. Please let me know if this is not a good idea! https://github.com/llvm/llvm-project/pull/117507 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits