diff options
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/destructor.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index d88d88c37ca..2e6c4c8ace6 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -2767,7 +2767,7 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { } // Warn if the class has virtual methods but non-virtual public destructor. - if (Record->isDynamicClass() && !Record->isDependentType()) { + if (Record->isPolymorphic() && !Record->isDependentType()) { CXXDestructorDecl *dtor = Record->getDestructor(); if (!dtor || (!dtor->isVirtual() && dtor->getAccess() == AS_public)) Diag(dtor ? dtor->getLocation() : Record->getLocation(), diff --git a/clang/test/SemaCXX/destructor.cpp b/clang/test/SemaCXX/destructor.cpp index ec437f7101e..14a4fb891cd 100644 --- a/clang/test/SemaCXX/destructor.cpp +++ b/clang/test/SemaCXX/destructor.cpp @@ -172,3 +172,8 @@ template<class T> class TS2 { // expected-warning {{'nonvirtualdtor::TS2<int>' h TS2<int> foo; // expected-note {{instantiation}} } + +namespace PR9238 { + class B { public: ~B(); }; + class C : virtual B { public: ~C() { } }; +} |

