[clang] [clang][Sema] fix crash on invalid expression with trailing return type and template keyword (PR #191972)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 08:49:34 PDT 2026


================
@@ -1514,7 +1514,8 @@ Sema::ActOnCXXTypeConstructExpr(ParsedType TypeRep,
                                           RParenOrBraceLoc, ListInitialization);
   if (Result.isInvalid())
     Result = CreateRecoveryExpr(TInfo->getTypeLoc().getBeginLoc(),
-                                RParenOrBraceLoc, exprs, Ty);
+                                RParenOrBraceLoc, exprs, Ty->isIncompleteType() ? QualType() : Ty);
----------------
erichkeane wrote:

Hmm... this isn't the right answer. We should be properly handling the recovery-expr where-ever this causes the problem, not by covering it up by giving the recovery-expr no type.

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


More information about the cfe-commits mailing list