diff options
Diffstat (limited to 'clang/lib/Sema/SemaTemplate.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 5470017303d..4c5f3bee15b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1677,6 +1677,9 @@ private: bool Explicit, TypeSourceInfo *TInfo, SourceLocation LocStart, SourceLocation Loc, SourceLocation LocEnd) { + ArrayRef<ParmVarDecl *> Params = + TInfo->getTypeLoc().castAs<FunctionProtoTypeLoc>().getParams(); + // Build the implicit deduction guide template. auto *Guide = FunctionDecl::Create(SemaRef.Context, DC, LocStart, Loc, DeductionGuideName, TInfo->getType(), @@ -1685,8 +1688,10 @@ private: if (Explicit) Guide->setExplicitSpecified(); Guide->setRangeEnd(LocEnd); - Guide->setParams( - TInfo->getTypeLoc().castAs<FunctionProtoTypeLoc>().getParams()); + Guide->setParams(Params); + + for (auto *Param : Params) + Param->setDeclContext(Guide); auto *GuideTemplate = FunctionTemplateDecl::Create( SemaRef.Context, DC, Loc, DeductionGuideName, TemplateParams, Guide); |

