Fix linkage computation for local types in template functions.
Template functions (and member functions of class templates) present the same
problem as inline functions. They need to be uniqued, so we need to assign
VisibleNoLinkage linkage to types defined in them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183222 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 80a32c5..a36fcf2 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -1049,8 +1049,12 @@
return LinkageInfo::none();
const FunctionDecl *FD = getOutermostFunctionContext(D);
- if (!FD || !FD->isInlined())
+ if (!FD)
return LinkageInfo::none();
+
+ if (!FD->isInlined() && FD->getTemplateSpecializationKind() == TSK_Undeclared)
+ return LinkageInfo::none();
+
LinkageInfo LV = getLVForDecl(FD, computation);
if (!isExternallyVisible(LV.getLinkage()))
return LinkageInfo::none();