From b1217ccafd1f81b241bb53e2e79888de2f8410c2 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Wed, 30 Dec 2015 05:40:32 +0000 Subject: [PATCH] [MS ABI] Add variable templates to the NameBackReferences Only function template specializations are exempt from being added to the NameBackReferences. Redundant variable template specializations should be appropriately substituted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256623 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/MicrosoftMangle.cpp | 2 +- test/CodeGenCXX/mangle-ms-cxx14.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 87d088cc11..136a43b640 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -698,7 +698,7 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND, // Function templates aren't considered for name back referencing. This // makes sense since function templates aren't likely to occur multiple // times in a symbol. - if (!isa(TD)) { + if (isa(TD)) { mangleTemplateInstantiationName(TD, *TemplateArgs); Out << '@'; return; diff --git a/test/CodeGenCXX/mangle-ms-cxx14.cpp b/test/CodeGenCXX/mangle-ms-cxx14.cpp index d649c59aed..9d30c406c8 100644 --- a/test/CodeGenCXX/mangle-ms-cxx14.cpp +++ b/test/CodeGenCXX/mangle-ms-cxx14.cpp @@ -49,3 +49,9 @@ int WithPMD = 0; template <> int WithPMD; // CHECK-DAG: "\01??$WithPMD@$GA@A@?0@@3HA" + +template +struct Foo {}; + +Foo<&x, &x> Zoo; +// CHECK-DAG: "\01?Zoo@@3U?$Foo@$1??$x@H@@3HA$1?1@3HA@@A" -- 2.50.1