[PATCH] SemaChecking: return type validation for member functions

Richard Smith richard at metafoo.co.uk
Wed Jan 8 16:03:13 PST 2014

  I agree with David that this seems like a strange place to put this particular check; this should be checked when we build a function type (per [class.abstract]p3) rather than when we build a call to the function. Indeed, we already have such a check, but there is presumably a bug somewhere causing us to not reach it when declaring a member function.

Comment at: lib/Sema/SemaExprCXX.cpp:4949-4954
@@ -4948,1 +4948,8 @@
+  if (!IsDecltype && RD->isAbstract() && !isa<CXXConstructExpr>(E)) {
+    Diag(E->getExprLoc(), diag::err_abstract_type_in_decl)
+      << Sema::AbstractReturnType << RT->desugar();
+    DiagnoseAbstractType(RD);
+    return Owned(E);
+  }
Can you use `RequireNonAbstractType` for this check?


More information about the cfe-commits mailing list