[clang] [clang] Accept empty enum in MSVC compatible C (PR #159981)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 8 07:31:24 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}}\
----------------
AaronBallman wrote:
I think emitting two diagnostics is fine (one for the underlying type and one for the empty enum) because they are separate extensions. But I think it's a bit odd that we claim the underlying type is a Microsoft extension rather than a C23 extension -- that seems to be a preexisting issue which could be handled in a separate PR: https://godbolt.org/z/sMhGoE3qq
https://github.com/llvm/llvm-project/pull/159981
More information about the cfe-commits
mailing list