[PATCH] D122981: [Clang] Diagnose incomplete return/param types only when function is not deleted

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 5 19:16:55 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:14457
   // The return type of a function definition must be complete
-  // (C99 6.9.1p3, C++ [dcl.fct]p6).
+  // unless the function is deleted
+  // (C99 6.9.1p3, C++ [dcl.fct.def.general]p2).
----------------



================
Comment at: clang/lib/Sema/SemaDecl.cpp:14461
   if (!ResultType->isDependentType() && !ResultType->isVoidType() &&
-      !FD->isInvalidDecl() &&
+      !FD->isInvalidDecl() && !FnDeleted &&
       RequireCompleteType(FD->getLocation(), ResultType,
----------------
I think we could remove the use of `FnDeleted` by the use of `FD->isDeleted()`. Also we should constrain the behavior only if std >= 11.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122981/new/

https://reviews.llvm.org/D122981



More information about the cfe-commits mailing list