]> granicus.if.org Git - clang/commitdiff
Fix PR9941 again, this time for templates.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Thu, 19 May 2011 16:25:27 +0000 (16:25 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Thu, 19 May 2011 16:25:27 +0000 (16:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131640 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/CXX/special/class.dtor/p3-0x.cpp

index fd28f2b6ee9d59b9f348faf05e7c92fb58914d9b..fcff0b8ea0d9b2d166b4c1fa34e72d0ed71ea7f8 100644 (file)
@@ -8200,8 +8200,10 @@ void Sema::ActOnFields(Scope* S,
       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();
       }
     }
index c2d2496beb63b8f71c97c16f44380a77936fbc72..ffac158acb6f16c1b1ddafd858b5e867b7bd6e56 100644 (file)
@@ -132,6 +132,10 @@ struct VX
 struct VY : VX
 { virtual ~VY() {} };
 
+template<typename T>
+struct TVY : VX
+{ virtual ~TVY() {} };
+
 
 struct VA {
   B b;
@@ -140,3 +144,28 @@ struct VA {
 
 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