@@ -2250,7 +2250,6 @@ struct ConvertConstructorToDeductionGuideTransform {
2250
2250
2251
2251
Sema &SemaRef;
2252
2252
ClassTemplateDecl *Template;
2253
- ClassTemplateDecl *NestedPattern = nullptr ;
2254
2253
2255
2254
DeclContext *DC = Template->getDeclContext ();
2256
2255
CXXRecordDecl *Primary = Template->getTemplatedDecl ();
@@ -2328,8 +2327,6 @@ struct ConvertConstructorToDeductionGuideTransform {
2328
2327
if (FTD) {
2329
2328
Args.addOuterTemplateArguments (SubstArgs);
2330
2329
Args.addOuterRetainedLevel ();
2331
- if (NestedPattern)
2332
- Args.addOuterRetainedLevels (NestedPattern->getTemplateDepth ());
2333
2330
}
2334
2331
2335
2332
FunctionProtoTypeLoc FPTL = CD->getTypeSourceInfo ()->getTypeLoc ()
@@ -2441,17 +2438,10 @@ struct ConvertConstructorToDeductionGuideTransform {
2441
2438
SmallVector<QualType, 4 > ParamTypes;
2442
2439
const FunctionProtoType *T = TL.getTypePtr ();
2443
2440
2444
- MultiLevelTemplateArgumentList OuterInstantiationArgs;
2445
- if (NestedPattern)
2446
- OuterInstantiationArgs = SemaRef.getTemplateInstantiationArgs (Template);
2447
-
2448
2441
// -- The types of the function parameters are those of the constructor.
2449
2442
for (auto *OldParam : TL.getParams ()) {
2450
2443
ParmVarDecl *NewParam =
2451
2444
transformFunctionTypeParam (OldParam, Args, MaterializedTypedefs);
2452
- if (NestedPattern && NewParam)
2453
- NewParam = transformFunctionTypeParam (NewParam, OuterInstantiationArgs,
2454
- MaterializedTypedefs);
2455
2445
if (!NewParam)
2456
2446
return QualType ();
2457
2447
ParamTypes.push_back (NewParam->getType ());
@@ -2657,23 +2647,13 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template,
2657
2647
if (BuildingDeductionGuides.isInvalid ())
2658
2648
return ;
2659
2649
2660
- // If the template is nested, then we need to use the original
2661
- // pattern to iterate over the constructors.
2662
- ClassTemplateDecl *Pattern = Transform.Template ;
2663
- while (Pattern->getInstantiatedFromMemberTemplate ()) {
2664
- if (Pattern->isMemberSpecialization ())
2665
- break ;
2666
- Pattern = Pattern->getInstantiatedFromMemberTemplate ();
2667
- Transform.NestedPattern = Pattern;
2668
- }
2669
-
2670
2650
// Convert declared constructors into deduction guide templates.
2671
2651
// FIXME: Skip constructors for which deduction must necessarily fail (those
2672
2652
// for which some class template parameter without a default argument never
2673
2653
// appears in a deduced context).
2674
2654
llvm::SmallPtrSet<NamedDecl *, 8 > ProcessedCtors;
2675
2655
bool AddedAny = false ;
2676
- for (NamedDecl *D : LookupConstructors (Pattern-> getTemplatedDecl () )) {
2656
+ for (NamedDecl *D : LookupConstructors (Transform. Primary )) {
2677
2657
D = D->getUnderlyingDecl ();
2678
2658
if (D->isInvalidDecl () || D->isImplicit ())
2679
2659
continue ;
0 commit comments