[cfe-commits] r131938 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiateDecl.cpp test/CodeGenCXX/cxx0x-defaulted-templates.cpp

Sean Hunt scshunt at csclub.uwaterloo.ca
Mon May 23 16:56:01 PDT 2011


Author: coppro
Date: Mon May 23 18:56:01 2011
New Revision: 131938

URL: http://llvm.org/viewvc/llvm-project?rev=131938&view=rev
Log:
Delete the extraneous return statement that was causing my earlier
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.

Added:
    cfe/trunk/test/CodeGenCXX/cxx0x-defaulted-templates.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=131938&r1=131937&r2=131938&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Mon May 23 18:56:01 2011
@@ -2439,8 +2439,6 @@
     ActOnFinishFunctionBody(Function, 0, /*IsInstantiation=*/true);
 
     SetDeclDefaulted(Function, PatternDecl->getLocation());
-
-    return;
   } else {
     // If this is a constructor, instantiate the member initializers.
     if (const CXXConstructorDecl *Ctor =

Added: cfe/trunk/test/CodeGenCXX/cxx0x-defaulted-templates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/cxx0x-defaulted-templates.cpp?rev=131938&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/cxx0x-defaulted-templates.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/cxx0x-defaulted-templates.cpp Mon May 23 18:56:01 2011
@@ -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;





More information about the cfe-commits mailing list