[clang] [clang] Check constexpr int->enum conversions consistently. (PR #143034)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 9 14:58:59 PDT 2025
================
@@ -2513,6 +2513,9 @@ void testValueInRangeOfEnumerationValues() {
// expected-error at -1 {{constexpr variable 'x2' must be initialized by a constant expression}}
// expected-note at -2 {{integer value 8 is outside the valid range of values [-8, 7] for the enumeration type 'E1'}}
E1 x2b = static_cast<E1>(8); // ok, not a constant expression context
+ static_assert(static_cast<E1>(8), "");
----------------
shafik wrote:
I guess these are the cases my previous checks missed?
https://github.com/llvm/llvm-project/pull/143034
More information about the cfe-commits
mailing list