forked from OSchip/llvm-project
Don't warn for -Wnon-virtual-dtor for dependent classes.
llvm-svn: 124735
This commit is contained in:
parent
96f6e379e2
commit
83b797f490
|
@ -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(),
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue