[PATCH] D150226: [Clang] Remove ability to downgrade warning on the diagnostic for setting a non fixed enum to a value outside the range of the enumeration values

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 11:52:05 PDT 2023


aaron.ballman added a comment.

In D150226#4353905 <https://reviews.llvm.org/D150226#4353905>, @dim wrote:

> I submitted a similar workaround for the FreeBSD devel/gdb port, via https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271045 that also applies `-Wno-enum-constexpr-conversion`. As the upstream commit message said, they didn't see any other good way to get rid of the warning, so if there is a workaround clang is OK with, that would be nice. Still, I don't really understand what the value is of making this warning into an error, that is not suppressible?

One of the major selling points to `constexpr` functions in C++ is that they cannot contain UB -- if your code compiles, it is correct. This bug that we've fixed was another instance of us accidentally allowing UB in a constant expression context when we shouldn't have. FWIW, I pointed out a reasonable workaround for the freebsd issue: https://reviews.llvm.org/D150226#4342516


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150226/new/

https://reviews.llvm.org/D150226



More information about the cfe-commits mailing list