================ @@ -1207,12 +1222,61 @@ void Sema::ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, // for e.g., [n{0}] { }; <-- if no <initializer_list> is included. // FIXME: we should create the init capture variable and mark it invalid // in this case. - if (C->InitCaptureType.get().isNull()) - continue; + // Ensure the initialization is valid before proceeding + + if (!C->InitCaptureType || C->InitCaptureType.get().isNull()) { + if (!C->Init.isUsable()) { + Diag(C->Loc, diag::err_invalid_lambda_capture_initializer_type); + continue; + } + + if (!C->Init.get()) { + continue; + } - if (C->Init.get()->containsUnexpandedParameterPack() && - !C->InitCaptureType.get()->getAs<PackExpansionType>()) - DiagnoseUnexpandedParameterPack(C->Init.get(), UPPC_Initializer); + ASTContext &Ctx = this->Context; + QualType DeducedType = C->Init.get()->getType(); + + if (DeducedType.isNull()) { + continue; + } + + if (DeducedType->isVoidType()) { + if (!DeducedType->isDependentType()) { ---------------- ojhunt wrote:
excess braces again https://github.com/llvm/llvm-project/pull/117953 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits