[clang] [clang][C23] Support N3029 Improved Normal Enumerations (PR #103917)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 3 15:18:52 PDT 2024


================
@@ -19553,17 +19555,18 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
 
         // If we're not in C++, diagnose the overflow of enumerator values,
         // which in C99 means that the enumerator value is not representable in
-        // an int (C99 6.7.2.2p2). However, we support GCC's extension that
-        // permits enumerator values that are representable in some larger
-        // integral type.
-        if (!getLangOpts().CPlusPlus && !T.isNull())
+        // an int (C99 6.7.2.2p2). However C23 permits enumerator values that
+        // are representable in some larger integral type and we allow it in
+        // older language modes as an extension.
+        if (!getLangOpts().CPlusPlus && !getLangOpts().C23 && !T.isNull())
           Diag(IdLoc, diag::warn_enum_value_overflow);
----------------
efriedma-quic wrote:

Should warn_enum_value_overflow also be updated to mention C23?

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


More information about the cfe-commits mailing list