[cfe-commits] r131640 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/CXX/special/class.dtor/p3-0x.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Thu May 19 09:25:27 PDT 2011


Author: cornedbee
Date: Thu May 19 11:25:27 2011
New Revision: 131640

URL: http://llvm.org/viewvc/llvm-project?rev=131640&view=rev
Log:
Fix PR9941 again, this time for templates.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp
    cfe/trunk/test/CXX/special/class.dtor/p3-0x.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=131640&r1=131639&r2=131640&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 19 11:25:27 2011
@@ -8200,8 +8200,10 @@
       const CXXDestructorDecl *Dtor =
               DelayedDestructorExceptionSpecChecks.back().first;
       if (Dtor->getParent() == Record) {
-        CheckOverridingFunctionExceptionSpec(Dtor,
-            DelayedDestructorExceptionSpecChecks.back().second);
+        // Don't check if we're a template. The spec hasn't been adjusted.
+        if (!Dtor->getParent()->isDependentType())
+          CheckOverridingFunctionExceptionSpec(Dtor,
+              DelayedDestructorExceptionSpecChecks.back().second);
         DelayedDestructorExceptionSpecChecks.pop_back();
       }
     }

Modified: cfe/trunk/test/CXX/special/class.dtor/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.dtor/p3-0x.cpp?rev=131640&r1=131639&r2=131640&view=diff
==============================================================================
--- cfe/trunk/test/CXX/special/class.dtor/p3-0x.cpp (original)
+++ cfe/trunk/test/CXX/special/class.dtor/p3-0x.cpp Thu May 19 11:25:27 2011
@@ -132,6 +132,10 @@
 struct VY : VX
 { virtual ~VY() {} };
 
+template<typename T>
+struct TVY : VX
+{ virtual ~TVY() {} };
+
 
 struct VA {
   B b;
@@ -140,3 +144,28 @@
 
 struct VB : VA
 { virtual ~VB() {} };
+
+template<typename T>
+struct TVB : VA
+{ virtual ~TVB() {} };
+
+void tinst2() {
+  TVY<int> tvy;
+  TVB<int> tvb;
+}
+
+template <typename T>
+struct Sw {
+  T t;
+  ~Sw() {}
+};
+
+void tsw() {
+  Sw<int> swi;
+  Sw<B> swb;
+}
+// CHECK-NOT: define linkonce_odr void @_ZN2SwI1BED1Ev({{.*}} nounwind
+// CHECK: define linkonce_odr void @_ZN2SwI1BED1Ev({{.*}}
+// CHECK: _ZTIi
+// CHECK: __cxa_call_unexpected
+// CHECK: define linkonce_odr void @_ZN2SwIiED1Ev({{.*}} nounwind





More information about the cfe-commits mailing list