From: Richard Smith Date: Wed, 8 Jan 2014 01:51:59 +0000 (+0000) Subject: RP18408: If a member template is used as a template template argument, it does X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0289ca20730afae5228f7fbb715d6b0e3d38d9c2;p=clang RP18408: If a member template is used as a template template argument, it does not cause the template specialization to have no linkage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198726 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 29443960c4..4e69a90636 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -782,11 +782,18 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, // 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(D) || isa(D) || isa(D) || isa(D) || - isa(D))) + isa(D) || + isa(D))) return LinkageInfo::none(); LinkageInfo LV; diff --git a/test/CodeGenCXX/linkage.cpp b/test/CodeGenCXX/linkage.cpp index 19f1b20773..b858ecbfe4 100644 --- a/test/CodeGenCXX/linkage.cpp +++ b/test/CodeGenCXX/linkage.cpp @@ -220,3 +220,11 @@ namespace test17 { } template int *foo<42>(); } + +// PR18408 +namespace test18 { + template class> struct A {}; + struct B { template struct C; }; + void f(A) {} + // CHECK-DAG: define void @_ZN6test181fENS_1AINS_1B1CEEE( +}