Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -6496,8 +6496,7 @@ // Check that the return type is not an abstract class type. // For record types, this is done by the AbstractClassUsageDiagnoser once // the class has been completely parsed. - if (!DC->isRecord() && - SemaRef.RequireNonAbstractType( + if (SemaRef.RequireNonAbstractType( D.getIdentifierLoc(), R->getAs()->getReturnType(), diag::err_abstract_type_in_decl, SemaRef.AbstractReturnType)) D.setInvalidType(); Index: test/SemaCXX/abstract.cpp =================================================================== --- test/SemaCXX/abstract.cpp +++ test/SemaCXX/abstract.cpp @@ -307,3 +307,14 @@ RedundantInit() : A(0) {} // expected-warning {{initializer for virtual base class 'pr16659::A' of abstract class 'RedundantInit' will never be used}} }; } + +namespace PR18393 { + struct A { + virtual void f() = 0; + }; + + struct B { + A f(); // expected-error {{return type 'PR18393::A' is an abstract class}} + }; +} +