[clang] Diagnose noreturn calls from a const or pure function (PR #206134)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 10:48:48 PDT 2026
Sirraide wrote:
@nikic Is calling a `noreturn` function from a `willreturn` function actually an issue in practice?
My two cents is that diagnosing this feels like it’ll cause a lot of false positives: `assert` and similar functions/macros often abort the program and end up calling `noreturn` functions inadvertently... which ought to be fine in a `const`/`pure` function—it doesn’t cause a problem if the assertion doesn’t fail, and conversely, if it _does_ fail, then that’s a bug in the program anyway.
Also, if this is semantically confusing, can we just remove `willreturn`? Does adding that make a difference in practice (it might, I’m not an optimiser guy candidly)?
https://github.com/llvm/llvm-project/pull/206134
More information about the cfe-commits
mailing list