[cfe-commits] r126966 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/warn-overloaded-virtual.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Thu Mar 3 14:58:57 PST 2011
Author: akirtzidis
Date: Thu Mar 3 16:58:57 2011
New Revision: 126966
URL: http://llvm.org/viewvc/llvm-project?rev=126966&view=rev
Log:
-Woverloaded-virtual shouldn't warn for static functions. Fixes rdar://9083431 & http://llvm.org/PR9396.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/warn-overloaded-virtual.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=126966&r1=126965&r2=126966&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Mar 3 16:58:57 2011
@@ -2838,7 +2838,8 @@
for (CXXRecordDecl::method_iterator M = Record->method_begin(),
MEnd = Record->method_end();
M != MEnd; ++M) {
- DiagnoseHiddenVirtualMethods(Record, *M);
+ if (!(*M)->isStatic())
+ DiagnoseHiddenVirtualMethods(Record, *M);
}
}
Modified: cfe/trunk/test/SemaCXX/warn-overloaded-virtual.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-overloaded-virtual.cpp?rev=126966&r1=126965&r2=126966&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-overloaded-virtual.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-overloaded-virtual.cpp Thu Mar 3 16:58:57 2011
@@ -52,3 +52,15 @@
void foo(int, int);
};
}
+
+namespace PR9396 {
+class A {
+public:
+ virtual void f(int) {}
+};
+
+class B : public A {
+public:
+ static void f() {}
+};
+}
More information about the cfe-commits
mailing list