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

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 14 08:07:58 PDT 2025


alexfh wrote:

Something went wrong here, since valid code started triggering the `-Winvalid-noreturn` diagnostic after this commit: https://gcc.godbolt.org/z/zvs9MG7rz

```
template<typename T>
struct S {
void f();
};

template<typename T>
void S<T>::f() { throw 0; }

template<>
void S<int>::f() {}
```

```
<source>:10:19: error: function declared 'noreturn' should not return [-Werror,-Winvalid-noreturn]
   10 | void S<int>::f() {}
      |                   ^
```

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


More information about the cfe-commits mailing list