File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -1976,14 +1976,16 @@ TemplateDeclInstantiator::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
19761976 if (!InstParams)
19771977 return nullptr ;
19781978
1979+ // Use canonical templated decl because only canonical decl has body
1980+ // if declarations were merged during loading from modules.
1981+ FunctionDecl *TemplatedDecl = D->getTemplatedDecl ()->getCanonicalDecl ();
19791982 FunctionDecl *Instantiated = nullptr ;
1980- if (CXXMethodDecl *DMethod = dyn_cast<CXXMethodDecl>(D-> getTemplatedDecl () ))
1981- Instantiated = cast_or_null<FunctionDecl>( VisitCXXMethodDecl (DMethod,
1982- InstParams));
1983+ if (CXXMethodDecl *DMethod = dyn_cast<CXXMethodDecl>(TemplatedDecl ))
1984+ Instantiated =
1985+ cast_or_null<FunctionDecl>( VisitCXXMethodDecl (DMethod, InstParams));
19831986 else
1984- Instantiated = cast_or_null<FunctionDecl>(VisitFunctionDecl (
1985- D->getTemplatedDecl (),
1986- InstParams));
1987+ Instantiated = cast_or_null<FunctionDecl>(
1988+ VisitFunctionDecl (TemplatedDecl, InstParams));
19871989
19881990 if (!Instantiated)
19891991 return nullptr ;
You can’t perform that action at this time.
0 commit comments