[clang] [Clang] Warn about `[[noreturn]]` on coroutines (PR #127623)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 18 12:49:11 PST 2025
================
@@ -1176,6 +1176,10 @@ void Sema::CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body) {
for (AddrLabelExpr *ALE : Fn->AddrLabels)
Diag(ALE->getBeginLoc(), diag::err_coro_invalid_addr_of_label);
+ // Coroutines always return a handle, so they can't be [[noreturn]].
+ if (Fn->isCoroutine())
+ Diag(FD->getLocation(), diag::warn_noreturn_coroutine) << FD;
----------------
Sirraide wrote:
Actually, I’m a bit slow today, now that I look at it, this was probably meant to be `Fn->isNoReturn()` wasn’t it.
https://github.com/llvm/llvm-project/pull/127623
More information about the cfe-commits
mailing list