r198726 - RP18408: If a member template is used as a template template argument, it does
Richard Smith
richard-llvm at metafoo.co.uk
Tue Jan 7 17:52:00 PST 2014
Author: rsmith
Date: Tue Jan 7 19:51:59 2014
New Revision: 198726
URL: http://llvm.org/viewvc/llvm-project?rev=198726&view=rev
Log:
RP18408: If a member template is used as a template template argument, it does
not cause the template specialization to have no linkage.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/linkage.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=198726&r1=198725&r2=198726&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Tue Jan 7 19:51:59 2014
@@ -782,11 +782,18 @@ static LinkageInfo getLVForClassMember(c
// really have linkage, but it's convenient to say they do for the
// purposes of calculating linkage of pointer-to-data-member
// template arguments.
+ //
+ // Templates also don't officially have linkage, but since we ignore
+ // the C++ standard and look at template arguments when determining
+ // linkage and visibility of a template specialization, we might hit
+ // a template template argument that way. If we do, we need to
+ // consider its linkage.
if (!(isa<CXXMethodDecl>(D) ||
isa<VarDecl>(D) ||
isa<FieldDecl>(D) ||
isa<IndirectFieldDecl>(D) ||
- isa<TagDecl>(D)))
+ isa<TagDecl>(D) ||
+ isa<TemplateDecl>(D)))
return LinkageInfo::none();
LinkageInfo LV;
Modified: cfe/trunk/test/CodeGenCXX/linkage.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linkage.cpp?rev=198726&r1=198725&r2=198726&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linkage.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linkage.cpp Tue Jan 7 19:51:59 2014
@@ -220,3 +220,11 @@ namespace test17 {
}
template int *foo<42>();
}
+
+// PR18408
+namespace test18 {
+ template<template<typename> class> struct A {};
+ struct B { template<typename> struct C; };
+ void f(A<B::C>) {}
+ // CHECK-DAG: define void @_ZN6test181fENS_1AINS_1B1CEEE(
+}
More information about the cfe-commits
mailing list