@@ -414,9 +414,11 @@ class SubstTemplateTemplateParmStorage
414414
415415 SubstTemplateTemplateParmStorage (TemplateName Replacement,
416416 Decl *AssociatedDecl, unsigned Index,
417- std::optional<unsigned > PackIndex)
417+ std::optional<unsigned > PackIndex,
418+ bool Final)
418419 : UncommonTemplateNameStorage(SubstTemplateTemplateParm, Index,
419- PackIndex ? *PackIndex + 1 : 0 ),
420+ ((PackIndex ? *PackIndex + 1 : 0 ) << 1 ) |
421+ Final),
420422 Replacement (Replacement), AssociatedDecl(AssociatedDecl) {
421423 assert (AssociatedDecl != nullptr );
422424 }
@@ -430,10 +432,15 @@ class SubstTemplateTemplateParmStorage
430432 // / This should match the result of `getParameter()->getIndex()`.
431433 unsigned getIndex () const { return Bits.Index ; }
432434
435+ // This substitution is Final, which means the substitution is fully
436+ // sugared: it doesn't need to be resugared later.
437+ bool getFinal () const { return Bits.Data & 1 ; }
438+
433439 std::optional<unsigned > getPackIndex () const {
434- if (Bits.Data == 0 )
440+ auto Data = Bits.Data >> 1 ;
441+ if (Data == 0 )
435442 return std::nullopt ;
436- return Bits. Data - 1 ;
443+ return Data - 1 ;
437444 }
438445
439446 TemplateTemplateParmDecl *getParameter () const ;
@@ -443,7 +450,7 @@ class SubstTemplateTemplateParmStorage
443450
444451 static void Profile (llvm::FoldingSetNodeID &ID, TemplateName Replacement,
445452 Decl *AssociatedDecl, unsigned Index,
446- std::optional<unsigned > PackIndex);
453+ std::optional<unsigned > PackIndex, bool Final );
447454};
448455
449456class DeducedTemplateStorage : public UncommonTemplateNameStorage ,
0 commit comments