]> granicus.if.org Git - clang/commitdiff
An inherited virtual (where "virtual" wasn't written explicitly) can
authorDouglas Gregor <dgregor@apple.com>
Tue, 1 Dec 2009 16:18:00 +0000 (16:18 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 1 Dec 2009 16:18:00 +0000 (16:18 +0000)
be defined as pure. Fixes PR5656.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90237 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/SemaCXX/virtual-override.cpp

index 520d7de710bd761bf6ae889d58ecb5328b2248dc..2087f8b8c6c8d2f0b7560db9226d61a1480d63a1 100644 (file)
@@ -3393,7 +3393,7 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
     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.
index 4a3b10fa976461fdde1922bec699423c43ce07b9..7ace886ff0dcbf253ec57db28e05c9f041682b0a 100644 (file)
@@ -104,3 +104,11 @@ namespace T7 {
     virtual b* f();
   };
 }
+
+// PR5656
+class X0 {
+  virtual void f0();
+};
+class X1 : public X0 {
+  void f0() = 0;
+};