================ @@ -13681,12 +13681,13 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { } Init = Result.getAs<Expr>(); + assert(Init && "Init must not be null"); + IsParenListInit = !InitSeq.steps().empty() && InitSeq.step_begin()->Kind == InitializationSequence::SK_ParenthesizedListInit; QualType VDeclType = VDecl->getType(); - if (Init && !Init->getType().isNull() && - !Init->getType()->isDependentType() && !VDeclType->isDependentType() && + if (!Init->getType()->isDependentType() && !VDeclType->isDependentType() && ---------------- mikerice1969 wrote:
> Was the static analysis tool perhaps complaining about later uses of `Init`? Yes. FWIW Here is the logic: ``` if (!VDecl->isInvalidDecl()) { ExprResult Result = InitSeq.Perform(*this, Entity, Kind, Args, &DclT); if (Result.isInvalid()) { return } Init = Result.getAs<Expr>(); if (Init && !Init->getType().isNull() && // verifier expects Init can be null. } … if (!VDecl->isInvalidDecl()) { .. Init->getBeginLoc())) // Deref of Init without check } ``` https://github.com/llvm/llvm-project/pull/94368 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits