@@ -5525,6 +5525,8 @@ static TemplateDeductionResult CheckDeductionConsistency(
55255525 // FIXME: A substitution can be incomplete on a non-structural part of the
55265526 // type. Use the canonical type for now, until the TemplateInstantiator can
55275527 // deal with that.
5528+ if (auto *Injected = P->getAs <InjectedClassNameType>())
5529+ P = Injected->getInjectedSpecializationType ();
55285530 QualType InstP = S.SubstType (P.getCanonicalType (), MLTAL, FTD->getLocation (),
55295531 FTD->getDeclName (), &IsIncompleteSubstitution);
55305532 if (InstP.isNull () && !IsIncompleteSubstitution)
@@ -5539,9 +5541,13 @@ static TemplateDeductionResult CheckDeductionConsistency(
55395541 if (auto *PA = dyn_cast<PackExpansionType>(A);
55405542 PA && !isa<PackExpansionType>(InstP))
55415543 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))
55455551 return TemplateDeductionResult::NonDeducedMismatch;
55465552 return TemplateDeductionResult::Success;
55475553}
0 commit comments