[clang] Suppress noreturn warning if last statement in a function is a throw (PR #145166)

Tibor Győri via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 23 08:24:09 PDT 2025


TiborGY wrote:

> I feel like this is a solution that can grow out of hand very easily. IMO the better solution would be to have `-Wmissing-noreturn` place a `[[noreturn]]` into the AST to avoid incorrect follow-up diagnostics.

I agree, in principle I would expect Clang to be able to prove (in simple cases) that a function cannot return, and then treat them -as-if they were marked as `[[noreturn]]` in the source code, not just for purposes of diagnostics but also optimization. Suppressing the `-Wreturn-type` warning does not achieve that.

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


More information about the cfe-commits mailing list