[cfe-commits] r90237 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/SemaCXX/virtual-override.cpp
Douglas Gregor
dgregor at apple.com
Tue Dec 1 08:18:01 PST 2009
Author: dgregor
Date: Tue Dec 1 10:18:00 2009
New Revision: 90237
URL: http://llvm.org/viewvc/llvm-project?rev=90237&view=rev
Log:
An inherited virtual (where "virtual" wasn't written explicitly) can
be defined as pure. Fixes PR5656.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/virtual-override.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=90237&r1=90236&r2=90237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Dec 1 10:18:00 2009
@@ -3393,7 +3393,7 @@
Expr *Init = static_cast<Expr *>(init.get());
if ((IL = dyn_cast<IntegerLiteral>(Init)) && IL->getValue() == 0 &&
Context.getCanonicalType(IL->getType()) == Context.IntTy) {
- if (Method->isVirtualAsWritten()) {
+ if (Method->isVirtual()) {
Method->setPure();
// A class is abstract if at least one function is pure virtual.
Modified: cfe/trunk/test/SemaCXX/virtual-override.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/virtual-override.cpp?rev=90237&r1=90236&r2=90237&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/virtual-override.cpp (original)
+++ cfe/trunk/test/SemaCXX/virtual-override.cpp Tue Dec 1 10:18:00 2009
@@ -104,3 +104,11 @@
virtual b* f();
};
}
+
+// PR5656
+class X0 {
+ virtual void f0();
+};
+class X1 : public X0 {
+ void f0() = 0;
+};
More information about the cfe-commits
mailing list