From: Rafael Espindola Date: Sat, 18 May 2013 00:33:28 +0000 (+0000) Subject: Handle local enum types too. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac8b151c4f0478c76a61f2044445b9367fa1a299;p=clang Handle local enum types too. Thanks to John McCall for pointing this out. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182182 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index cbd55889c9..8a523d6a0d 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -298,11 +298,8 @@ static LinkageInfo getLIForTemplateTypeArgument(QualType T) { if (!TT) return LI; - const CXXRecordDecl *RD = dyn_cast(TT->getDecl()); - if (!RD) - return LI; - - const FunctionDecl *FD = getOutermostFunctionContext(RD); + const Decl *D = TT->getDecl(); + const FunctionDecl *FD = getOutermostFunctionContext(D); if (!FD) return LI; diff --git a/test/CodeGenCXX/linkage.cpp b/test/CodeGenCXX/linkage.cpp index 732c3cfcc4..ce93161cad 100644 --- a/test/CodeGenCXX/linkage.cpp +++ b/test/CodeGenCXX/linkage.cpp @@ -92,3 +92,14 @@ namespace test7 { void *h() { return g(); } } + +namespace test8 { + // CHECK-DAG: define linkonce_odr void @_ZN5test81fIZNS_1gEvE1SEEvT_( + template void f(T) {} + inline void *g() { + enum S { + }; + return reinterpret_cast(f); + } + void *h() { return g(); } +}