================
@@ -13456,6 +13455,14 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr 
*Init, bool DirectInit) {
     return;
   }
 
+  if (VDecl->isInvalidDecl()) {
+    CorrectDelayedTyposInExpr(Init, VDecl);
+    VDecl->setInit(
+        CreateRecoveryExpr(Init->getBeginLoc(), Init->getEndLoc(), {Init})
+            .get());
----------------
mizvekov wrote:

`CreateRecoveryExpr` returns an ExprResult, which means it not only returns an 
expression on success, but it can also return an error, and using `get()` in 
that case is UB, you have to check it first.

It can return an error in case we are in an SFINAE context, and also when using 
the frontend flag `-fno-recovery-ast`.

https://github.com/llvm/llvm-project/pull/88645
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to