================
@@ -2513,6 +2513,9 @@ void testValueInRangeOfEnumerationValues() {
// expected-error@-1 {{constexpr variable 'x2' must be initialized by a
constant expression}}
// expected-note@-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), "");
----------------
efriedma-quic wrote:
Yes. The static_assert case wasn't emitting an error because of the
`Info.EvalMode == EvalInfo::EM_ConstantExpression` check. The
"neg_one_constexpr" case wasn't emitting an error because of the ConstexprVar
check.
(Looking again, I guess I could have also come up with a separate testcase for
the InConstantContext check, but I didn't really think too deeply about it.)
https://github.com/llvm/llvm-project/pull/143034
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits