@@ -5525,6 +5525,8 @@ static TemplateDeductionResult CheckDeductionConsistency(
5525
5525
// FIXME: A substitution can be incomplete on a non-structural part of the
5526
5526
// type. Use the canonical type for now, until the TemplateInstantiator can
5527
5527
// deal with that.
5528
+ if (auto *Injected = dyn_cast<InjectedClassNameType>(P))
5529
+ P = Injected->getInjectedSpecializationType ();
5528
5530
QualType InstP = S.SubstType (P.getCanonicalType (), MLTAL, FTD->getLocation (),
5529
5531
FTD->getDeclName (), &IsIncompleteSubstitution);
5530
5532
if (InstP.isNull () && !IsIncompleteSubstitution)
@@ -5539,9 +5541,13 @@ static TemplateDeductionResult CheckDeductionConsistency(
5539
5541
if (auto *PA = dyn_cast<PackExpansionType>(A);
5540
5542
PA && !isa<PackExpansionType>(InstP))
5541
5543
A = PA->getPattern ();
5542
- if (!S.Context .hasSameType (
5543
- S.Context .getUnqualifiedArrayType (InstP.getNonReferenceType ()),
5544
- S.Context .getUnqualifiedArrayType (A.getNonReferenceType ())))
5544
+ auto T1 = S.Context .getUnqualifiedArrayType (InstP.getNonReferenceType ());
5545
+ auto T2 = S.Context .getUnqualifiedArrayType (A.getNonReferenceType ());
5546
+ if (auto *Injected = T1->getAs <InjectedClassNameType>())
5547
+ T1 = Injected->getInjectedSpecializationType ();
5548
+ if (auto *Injected = T2->getAs <InjectedClassNameType>())
5549
+ T2 = Injected->getInjectedSpecializationType ();
5550
+ if (!S.Context .hasSameType (T1, T2))
5545
5551
return TemplateDeductionResult::NonDeducedMismatch;
5546
5552
return TemplateDeductionResult::Success;
5547
5553
}
0 commit comments