================ @@ -3910,8 +3910,13 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, FnRetType = FD->getReturnType(); if (FD->hasAttrs()) Attrs = &FD->getAttrs(); - if (FD->isNoReturn()) - Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD; + if (FD->isNoReturn()) { + const FunctionScopeInfo *Scope = getEnclosingFunction(); + if (Scope && Scope->isCoroutine()) + Diag(ReturnLoc, diag::warn_noreturn_coroutine) << FD; + else + Diag(ReturnLoc, diag::warn_noreturn_function_has_return_expr) << FD; + } ---------------- Sirraide wrote:
Also, looking at the AST, I think the only way for us to end up in `BuildReturnStmt` in a coroutine is for the `ReturnStmt` that the compiler implicitly generates for the call to `get_return_object()` since `return` is disallowed in coroutines; I don’t think we really care to diagnose that (because seriously, if e.g. `get_return_object()` is `noreturn`, then witw is the user trying to accomplish with that...) https://github.com/llvm/llvm-project/pull/127623 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits