[cfe-commits] r124735 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/destructor.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed Feb 2 10:47:42 PST 2011
Author: akirtzidis
Date: Wed Feb 2 12:47:41 2011
New Revision: 124735
URL: http://llvm.org/viewvc/llvm-project?rev=124735&view=rev
Log:
Don't warn for -Wnon-virtual-dtor for dependent classes.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/destructor.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=124735&r1=124734&r2=124735&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Feb 2 12:47:41 2011
@@ -2771,7 +2771,7 @@
}
// 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(),
Modified: cfe/trunk/test/SemaCXX/destructor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/destructor.cpp?rev=124735&r1=124734&r2=124735&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/destructor.cpp (original)
+++ cfe/trunk/test/SemaCXX/destructor.cpp Wed Feb 2 12:47:41 2011
@@ -159,4 +159,16 @@
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}}
}
More information about the cfe-commits
mailing list