[cfe-commits] r91558 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/abstract.cpp
Eli Friedman
eli.friedman at gmail.com
Wed Dec 16 12:00:27 PST 2009
Author: efriedma
Date: Wed Dec 16 14:00:27 2009
New Revision: 91558
URL: http://llvm.org/viewvc/llvm-project?rev=91558&view=rev
Log:
Correctly calcluate abstract-ness in the case where an implicitly declared
method overrides a pure virtual method.
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=91558&r1=91557&r2=91558&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Dec 16 14:00:27 2009
@@ -1979,6 +1979,12 @@
if (!Record || Record->isInvalidDecl())
return;
+ if (!Record->isDependentType())
+ AddImplicitlyDeclaredMembersToClass(Record);
+
+ if (Record->isInvalidDecl())
+ return;
+
if (!Record->isAbstract()) {
// Collect all the pure virtual methods and see if this is an abstract
// class after all.
@@ -1989,9 +1995,6 @@
if (Record->isAbstract())
(void)AbstractClassUsageDiagnoser(*this, Record);
-
- if (!Record->isDependentType() && !Record->isInvalidDecl())
- AddImplicitlyDeclaredMembersToClass(Record);
}
void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc,
Modified: cfe/trunk/test/SemaCXX/abstract.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/abstract.cpp?rev=91558&r1=91557&r2=91558&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/abstract.cpp (original)
+++ cfe/trunk/test/SemaCXX/abstract.cpp Wed Dec 16 14:00:27 2009
@@ -155,3 +155,17 @@
};
C x;
}
+
+namespace PureImplicit {
+ // A pure virtual destructor should be implicitly overridden.
+ struct A { virtual ~A() = 0; };
+ struct B : A {};
+ B x;
+
+ // A pure virtual assignment operator should be implicitly overridden.
+ struct D;
+ struct C { virtual D& operator=(const D&) = 0; };
+ struct D : C {};
+ D y;
+}
+
More information about the cfe-commits
mailing list