[clang] Diagnose noreturn calls from a const or pure function (PR #206134)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 26 10:54:09 PDT 2026


AaronBallman wrote:

> I dont think this works in templates if the 'noreturn' function is not known at parse time, right? Can you test:
> 
> ```
> template<typename T> 
> [[pure]] int templ() {
> T::nrcall();
> return 12;
> }
> 
> struct S {
> [[noreturn]] void nrcall();
> };
> ```

Test added, and correct, no diagnostic is emitted there because the call not yet be resolved. The uninstantiated diagnostic is because the call isn't dependent in any way.

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


More information about the cfe-commits mailing list