[clang] Fix crash with invalid VLA in a type trait (PR #138543)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon May 5 08:39:45 PDT 2025


================
@@ -4700,6 +4700,10 @@ ExprResult Sema::CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo,
       TInfo->getType()->isVariablyModifiedType())
     TInfo = TransformToPotentiallyEvaluated(TInfo);
 
+  // It's possible that the transformation above failed.
+  if (!TInfo)
+    return ExprError();
----------------
erichkeane wrote:

Hmm... i guess we do the same problem above, but it is a shame we don't do a better job trying to just create one of these with a RecoveryExpr in the expr.

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


More information about the cfe-commits mailing list