[clang] [Clang] Warn about `[[noreturn]]` on coroutines (PR #127623)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 18 12:49:32 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;
----------------
Nerixyz wrote:
Yea, just noticed that I wanted to check if it's noreturn 😅
https://github.com/llvm/llvm-project/pull/127623
More information about the cfe-commits
mailing list