[clang] Add flag to suppress overflow errors in C++ constant expressions. (PR #102390)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 12:03:59 PDT 2024


efriedma-quic wrote:

I targeted all overflows with this fix because we were missing diagnostics for all overflows.  For example, "enum{x=999999*999999};" only produces a pedantic warning on clang 18.  So if we need the extra flexibility, we should just add it for everything.

I think a default-error, sfinae-failing diagnostic should be pretty safe; everyone will get the correct diagnostics by default, and some narrow subset of people can disable them if they cause issues.

MSVC ignores most forms of overflow by default (/W2 enables warnings); gcc errors by default, but allows degrading the error to a warning with -fpermissive.

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


More information about the cfe-commits mailing list