diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-05-19 16:25:27 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2011-05-19 16:25:27 +0000 |
commit | 42bef03a0f0462a95eb66b9e63feab0bf596134d (patch) | |
tree | 37b94f470bc30e945310a891cd642598ceab7720 | |
parent | de5c048fedb81f9b91c80cee1e5f4afd551dadd6 (diff) |
Fix PR9941 again, this time for templates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131640 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 | ||||
-rw-r--r-- | test/CXX/special/class.dtor/p3-0x.cpp | 29 |
2 files changed, 33 insertions, 2 deletions
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<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 |