[clang] [Analysis] Avoid some warnings about exit from noreturn function (PR #144408)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 12:17:58 PDT 2025
================
@@ -0,0 +1,107 @@
+// RUN: %clang_cc1 -fsyntax-only %s -verify
+
+[[noreturn]] extern void noret();
+[[noreturn]] extern void noret2();
+extern void ordinary();
+
+typedef void (*func_type)(void);
+
----------------
AaronBallman wrote:
Another test case that would be good to add:
```
[[noreturn void func(void (*fp)() = noret) {
fp();
}
```
This should diagnose still because there's no reason to presume the default argument is actually being used. Same if `fp` is a `const` pointer to function.
https://github.com/llvm/llvm-project/pull/144408
More information about the cfe-commits
mailing list