]> granicus.if.org Git - clang/commitdiff
Delete the extraneous return statement that was causing my earlier
authorSean Hunt <scshunt@csclub.uwaterloo.ca>
Mon, 23 May 2011 23:56:01 +0000 (23:56 +0000)
committerSean Hunt <scshunt@csclub.uwaterloo.ca>
Mon, 23 May 2011 23:56:01 +0000 (23:56 +0000)
issues and also add a test.

We should now handle defaulted members of templates properly. No
comment as to whether or not this also holds for templated functions,
but defaulting those is kind of insane.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131938 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiateDecl.cpp
test/CodeGenCXX/cxx0x-defaulted-templates.cpp [new file with mode: 0644]

index 2481bd004dca83120ab78867389f14f8e127ad97..701493cf988b69088e402162c8e273501f43e192 100644 (file)
@@ -2439,8 +2439,6 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
     ActOnFinishFunctionBody(Function, 0, /*IsInstantiation=*/true);
 
     SetDeclDefaulted(Function, PatternDecl->getLocation());
-
-    return;
   } else {
     // If this is a constructor, instantiate the member initializers.
     if (const CXXConstructorDecl *Ctor =
diff --git a/test/CodeGenCXX/cxx0x-defaulted-templates.cpp b/test/CodeGenCXX/cxx0x-defaulted-templates.cpp
new file mode 100644 (file)
index 0000000..3d4000e
--- /dev/null
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -std=c++0x -emit-llvm -o - %s | FileCheck %s
+
+template <typename T>
+struct X {
+  X();
+};
+
+// CHECK: define void @_ZN1XIbEC1Ev
+// CHECK: define void @_ZN1XIbEC2Ev
+template <> X<bool>::X() = default;
+
+// CHECK: define weak_odr void @_ZN1XIiEC1Ev
+// CHECK: define weak_odr void @_ZN1XIiEC2Ev
+template <typename T> X<T>::X() = default;
+template X<int>::X();
+
+// CHECK: define linkonce_odr void @_ZN1XIcEC1Ev
+// CHECK: define linkonce_odr void @_ZN1XIcEC2Ev
+X<char> x;