From: Sebastian Redl Date: Thu, 19 May 2011 16:25:27 +0000 (+0000) Subject: Fix PR9941 again, this time for templates. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42bef03a0f0462a95eb66b9e63feab0bf596134d;p=clang Fix PR9941 again, this time for templates. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131640 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index fd28f2b6ee..fcff0b8ea0 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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(); } } diff --git a/test/CXX/special/class.dtor/p3-0x.cpp b/test/CXX/special/class.dtor/p3-0x.cpp index c2d2496beb..ffac158acb 100644 --- a/test/CXX/special/class.dtor/p3-0x.cpp +++ b/test/CXX/special/class.dtor/p3-0x.cpp @@ -132,6 +132,10 @@ struct VX struct VY : VX { virtual ~VY() {} }; +template +struct TVY : VX +{ virtual ~TVY() {} }; + struct VA { B b; @@ -140,3 +144,28 @@ struct VA { struct VB : VA { virtual ~VB() {} }; + +template +struct TVB : VA +{ virtual ~TVB() {} }; + +void tinst2() { + TVY tvy; + TVB tvb; +} + +template +struct Sw { + T t; + ~Sw() {} +}; + +void tsw() { + Sw swi; + Sw 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