]> granicus.if.org Git - clang/commitdiff
Ignore constructor member templates in CodeGenModule::EmitTopLevelDecl.
authorAnders Carlsson <andersca@mac.com>
Tue, 24 Nov 2009 05:16:24 +0000 (05:16 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 24 Nov 2009 05:16:24 +0000 (05:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89737 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/CodeGenCXX/member-templates.cpp [new file with mode: 0644]

index 5744489f2f53d96bf03fb1da4ff51a532571feac..7cd9e9f81be33843f54f3d59b426dd07cba2db79 100644 (file)
@@ -1734,6 +1734,10 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
   case Decl::NamespaceAlias:
     break;
   case Decl::CXXConstructor:
+    // Skip function templates
+    if (cast<FunctionDecl>(D)->getDescribedFunctionTemplate())
+      return;
+      
     EmitCXXConstructors(cast<CXXConstructorDecl>(D));
     break;
   case Decl::CXXDestructor:
diff --git a/test/CodeGenCXX/member-templates.cpp b/test/CodeGenCXX/member-templates.cpp
new file mode 100644 (file)
index 0000000..c2df012
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang-cc %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+
+// CHECK: ; ModuleID
+struct A {
+  template<typename T>
+  A(T);
+};
+
+template<typename T> A::A(T) {}