[clang] [clang] Accept empty enum in MSVC compatible C (PR #159981)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 30 09:56:03 PDT 2025
================
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
+
+typedef enum tag1 { } A; // expected-warning {{empty enumeration types are a Microsoft extension}}
+typedef enum tag2 { } B; // expected-warning {{empty enumeration types are a Microsoft extension}}
+typedef enum : unsigned { } C; // expected-warning {{enumeration types with a fixed underlying type are a Microsoft extension}}\
----------------
yicuixi wrote:
Thanks for the review!
> Also, isn't this a C23 extension, not a microsoft extension (or at least, as well)? See: ext_c23_enum_fixed_underlying_type.
In microsoft-extension mode, it's `ext_ms_c_enum_fixed_underlying_type` but not `ext_ms_c_enum_fixed_underlying_type`.
> This shouldn't warn 2x, the 'with a fixed underlying type' version is sufficient.
Should we suppress the 2nd `empty enumeration types are a Microsoft extension` warning? Seems they are 2 different issue.
https://github.com/llvm/llvm-project/pull/159981
More information about the cfe-commits
mailing list