[clang] [clang][AST] Assert that ConstantExpr type and APValue kind match (PR #230388)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 08:00:23 PDT 2026


================
@@ -384,6 +488,7 @@ ConstantExpr *ConstantExpr::CreateEmpty(const ASTContext &Context,
 void ConstantExpr::MoveIntoResult(APValue &Value, const ASTContext &Context) {
   assert((unsigned)getStorageKind(Value) <= ConstantExprBits.ResultKind &&
          "Invalid storage for this value kind");
+  assertAPValueKind(this, Value);
----------------
AaronBallman wrote:

Without timing information, I could just be guessing, but these seems like the kind of checks we would only enable in an asserts build under the assumption that a full release build doesn't need this level of checking and thus doesn't need to pay a compile time overhead penalty.

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


More information about the cfe-commits mailing list