@@ -859,12 +859,9 @@ class PackDeductionScope {
859
859
Info.PendingDeducedPacks [Pack.Index ] = Pack.Outer ;
860
860
}
861
861
862
- std::optional<unsigned > getSavedPackSize (unsigned Index,
863
- TemplateArgument Pattern) const {
864
-
865
- SmallVector<UnexpandedParameterPack, 2 > Unexpanded;
866
- S.collectUnexpandedParameterPacks (Pattern, Unexpanded);
867
- if (Unexpanded.size () == 0 ||
862
+ // Return the size of the saved packs if all of them has the same size.
863
+ std::optional<unsigned > getSavedPackSizeIfAllEqual () const {
864
+ if (Packs.size () == 0 ||
868
865
Packs[0 ].Saved .getKind () != clang::TemplateArgument::Pack)
869
866
return {};
870
867
unsigned PackSize = Packs[0 ].Saved .pack_size ();
@@ -4411,13 +4408,8 @@ Sema::TemplateDeductionResult Sema::DeduceTemplateArguments(
4411
4408
// that, in this case we are not processing all of the remaining
4412
4409
// arguments. We are only process as many arguments as much we have in
4413
4410
// the already deduced parameter.
4414
- SmallVector<UnexpandedParameterPack, 2 > Unexpanded;
4415
- collectUnexpandedParameterPacks (ParamPattern, Unexpanded);
4416
- assert (Unexpanded.size () != 0 && " We must have an unexpanded pack\n " );
4417
-
4418
4411
std::optional<unsigned > ArgPosAfterSubstitution =
4419
- PackScope.getSavedPackSize (getDepthAndIndex (Unexpanded[0 ]).second ,
4420
- ParamPattern);
4412
+ PackScope.getSavedPackSizeIfAllEqual ();
4421
4413
if (!ArgPosAfterSubstitution)
4422
4414
continue ;
4423
4415
0 commit comments