Skip to content

Commit fd03551

Browse files
committed
add IsInvalid check
1 parent 53c6c6a commit fd03551

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

clang/lib/Sema/SemaTemplateDeduction.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3580,16 +3580,12 @@ static Sema::TemplateDeductionResult instantiateExplicitSpecifierDeferred(
35803580
if (!Expr->isValueDependent()) {
35813581
return Sema::TDK_Success;
35823582
}
3583-
// The `InstantiatingTemplate` here is used to restore `ActiveInstType` to
3584-
// `DeducedTemplateArgumentSubstitution` because ActiveInstType was set to
3585-
// `TemplateInstantiation` in
3586-
// `TemplateDeclInstantiator::InitFunctionInstantiation`. The real depth of
3587-
// instantiation should be the same as the depth in
3588-
// `FinishTemplateArgumentDeduction`.
3589-
// So we don't check `InstantiatingTemplate::IsValid` here.
35903583
Sema::InstantiatingTemplate Inst(
35913584
S, Info.getLocation(), FunctionTemplate, DeducedArgs,
35923585
Sema::CodeSynthesisContext::DeducedTemplateArgumentSubstitution, Info);
3586+
if (Inst.isInvalid()) {
3587+
return Sema::TDK_InstantiationDepth;
3588+
}
35933589
Sema::SFINAETrap Trap(S);
35943590
const auto Instantiated = S.instantiateExplicitSpecifier(SubstArgs, ES);
35953591
if (Instantiated.isInvalid() || Trap.hasErrorOccurred()) {

0 commit comments

Comments
 (0)