[NFC] Make sure we check an optional when checking function constraints

For some reason the initial deferred concepts patch didn't add this
check, which someone noticed could cause a problem with other patches
applied.  This makes sure we check these, so that an error condition
cannot cause us to crash.
This commit is contained in:
Erich Keane
2022-10-21 07:31:26 -07:00
parent 87549e61da
commit a726be3875
2 changed files with 5 additions and 2 deletions

View File

@@ -7211,7 +7211,7 @@ private:
FunctionDecl *FD, llvm::Optional<ArrayRef<TemplateArgument>> TemplateArgs,
MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope);
/// Used during constraint checking, sets up the constraint template arguemnt
/// Used during constraint checking, sets up the constraint template argument
/// lists, and calls SetupConstraintScope to set up the
/// LocalInstantiationScope to have the proper set of ParVarDecls configured.
llvm::Optional<MultiLevelTemplateArgumentList>

View File

@@ -511,7 +511,7 @@ Sema::SetupConstraintCheckingTemplateArgumentsAndScope(
/*Pattern=*/nullptr,
/*ForConstraintInstantiation=*/true);
if (SetupConstraintScope(FD, TemplateArgs, MLTAL, Scope))
return {};
return llvm::None;
return MLTAL;
}
@@ -547,6 +547,9 @@ bool Sema::CheckFunctionConstraints(const FunctionDecl *FD,
SetupConstraintCheckingTemplateArgumentsAndScope(
const_cast<FunctionDecl *>(FD), {}, Scope);
if (!MLTAL)
return true;
Qualifiers ThisQuals;
CXXRecordDecl *Record = nullptr;
if (auto *Method = dyn_cast<CXXMethodDecl>(FD)) {