Don't warn for -Wnon-virtual-dtor for dependent classes.

llvm-svn: 124735
This commit is contained in:
Argyrios Kyrtzidis 2011-02-02 18:47:41 +00:00
parent 96f6e379e2
commit 83b797f490
2 changed files with 13 additions and 1 deletions

View File

@ -2771,7 +2771,7 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) {
}
// Warn if the class has virtual methods but non-virtual public destructor.
if (Record->isDynamicClass()) {
if (Record->isDynamicClass() && !Record->isDependentType()) {
CXXDestructorDecl *dtor = Record->getDestructor();
if (!dtor || (!dtor->isVirtual() && dtor->getAccess() == AS_public))
Diag(dtor ? dtor->getLocation() : Record->getLocation(),

View File

@ -159,4 +159,16 @@ struct S7 {
protected:
~S7();
};
template<class T> class TS : public B {
virtual void m();
};
TS<int> baz;
template<class T> class TS2 { // expected-warning {{'nonvirtualdtor::TS2<int>' has virtual functions but non-virtual destructor}}
virtual void m();
};
TS2<int> foo; // expected-note {{instantiation}}
}