aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-18 19:34:08 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-18 19:34:08 +0000
commit2782302961b6f57316b1ece494c7135b65e18b30 (patch)
tree16fe243872e1548055b44aee8cd317c47fa8b982
parentc6b29163557d02da5d2a4a06f986f0480291f51f (diff)
It's OK for a pure virtual function to override another pure virtual function. Fixes PR5222.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84428 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclCXX.cpp6
-rw-r--r--test/SemaCXX/abstract.cpp15
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 419c8a13c2..d2ef113b30 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -1658,12 +1658,10 @@ namespace {
// 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.
diff --git a/test/SemaCXX/abstract.cpp b/test/SemaCXX/abstract.cpp
index e14304a26f..42b8d7febe 100644
--- a/test/SemaCXX/abstract.cpp
+++ b/test/SemaCXX/abstract.cpp
@@ -123,3 +123,18 @@ struct K {
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;
+}