[cfe-commits] r84428 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/abstract.cpp
Anders Carlsson
andersca at mac.com
Sun Oct 18 12:34:12 PDT 2009
Author: andersca
Date: Sun Oct 18 14:34:08 2009
New Revision: 84428
URL: http://llvm.org/viewvc/llvm-project?rev=84428&view=rev
Log:
It's OK for a pure virtual function to override another pure virtual function. Fixes PR5222.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaCXX/abstract.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=84428&r1=84427&r2=84428&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Oct 18 14:34:08 2009
@@ -1658,12 +1658,10 @@
// Traverse the record, looking for methods.
if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*i)) {
// If the method is pure virtual, add it to the methods vector.
- if (MD->isPure()) {
+ if (MD->isPure())
Methods.push_back(MD);
- continue;
- }
- // Otherwise, record all the overridden methods in our set.
+ // Record all the overridden methods in our set.
for (CXXMethodDecl::method_iterator I = MD->begin_overridden_methods(),
E = MD->end_overridden_methods(); I != E; ++I) {
// Keep track of the overridden methods.
Modified: cfe/trunk/test/SemaCXX/abstract.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/abstract.cpp?rev=84428&r1=84427&r2=84428&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/abstract.cpp (original)
+++ cfe/trunk/test/SemaCXX/abstract.cpp Sun Oct 18 14:34:08 2009
@@ -123,3 +123,18 @@
struct L : public K {
void f();
};
+
+// PR5222
+namespace PR5222 {
+ struct A {
+ virtual A *clone() = 0;
+ };
+ struct B : public A {
+ virtual B *clone() = 0;
+ };
+ struct C : public B {
+ virtual C *clone();
+ };
+
+ C c;
+}
More information about the cfe-commits
mailing list