r179581 - Correctly propagate the storage class to function template instantiations.
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 15 19:29:15 PDT 2013
Author: rafael
Date: Mon Apr 15 21:29:15 2013
New Revision: 179581
URL: http://llvm.org/viewvc/llvm-project?rev=179581&view=rev
Log:
Correctly propagate the storage class to function template instantiations.
This fixes pr15753. This is another case of the fuzzy definition of the
"as written" storage class of an instantiation.
Added:
cfe/trunk/test/CodeGenCXX/pr15753.cpp
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=179581&r1=179580&r2=179581&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon Apr 15 21:29:15 2013
@@ -1162,7 +1162,7 @@ Decl *TemplateDeclInstantiator::VisitFun
FunctionDecl *Function =
FunctionDecl::Create(SemaRef.Context, DC, D->getInnerLocStart(),
D->getNameInfo(), T, TInfo,
- D->getStorageClass(),
+ D->getCanonicalDecl()->getStorageClass(),
D->isInlineSpecified(), D->hasWrittenPrototype(),
D->isConstexpr());
Added: cfe/trunk/test/CodeGenCXX/pr15753.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/pr15753.cpp?rev=179581&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/pr15753.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/pr15753.cpp Mon Apr 15 21:29:15 2013
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+
+template <typename T> static int Foo(T t);
+template <typename T>
+int Foo(T t) {
+ return t;
+}
+template<> int Foo<int>(int i) {
+ return i;
+}
+
+// CHECK-NOT: define
More information about the cfe-commits
mailing list