[clang] Surface error for plain return statement in coroutine earlier (PR #100985)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 1 01:56:07 PDT 2024


================
@@ -1120,7 +1120,7 @@ void Sema::CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body) {
 
   // [stmt.return.coroutine]p1:
   //   A coroutine shall not enclose a return statement ([stmt.return]).
-  if (Fn->FirstReturnLoc.isValid()) {
+  if (Fn->FirstReturnLoc.isValid() && Fn->FirstReturnLoc < Fn->FirstCoroutineStmtLoc) {
----------------
ivanaivanovska wrote:

Done.

https://github.com/llvm/llvm-project/pull/100985


More information about the cfe-commits mailing list