================ @@ -13570,6 +13570,15 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { CreateRecoveryExpr(Init->getBeginLoc(), Init->getEndLoc(), Args); if (RecoveryExpr.get()) VDecl->setInit(RecoveryExpr.get()); + // In general, for error recovery purposes, the initalizer doesn't play + // part in the valid bit of the declaration. There are a few exceptions: + // 1) if the var decl has a deduced auto type, and the type cannot be + // deduced by an invalid initializer; + // 2) if the var decl is decompsition decl with a non-deduced type, and + // the initialization fails (e.g. `int [a] = {1, 2};`); + // Case 1) was already handled elsewhere. + if (llvm::isa<DecompositionDecl>(VDecl)) // Case 2) ---------------- AaronBallman wrote:
```suggestion if (isa<DecompositionDecl>(VDecl)) // Case 2) ``` https://github.com/llvm/llvm-project/pull/72428 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits