Issue |
151501
|
Summary |
[clang] -Wunreachable-code is unexpectedly triggered by expressions in the `noexcept` operator
|
Labels |
clang:diagnostics,
false-positive
|
Assignees |
|
Reporter |
frederick-vs-ja
|
Code ([Godbolt link](https://godbolt.org/z/ja195jY13)):
```C++
template<int I, class T>
void get(T&&) {}
void test() {
int n{};
[[maybe_unused]] constexpr bool V = noexcept(::get<0>(n)) && noexcept(::get<1>(n));
}
```
Warning message:
```
<source>:6:73: warning: code will never be executed [-Wunreachable-code]
6 | [[maybe_unused]] constexpr bool V = noexcept(::get<0>(n)) && noexcept(::get<1>(n));
| ^~~~~~~~
1 warning generated.
Compiler returned: 0
```
This doesn't seem to be regression.
I _think_ this is false-positive as the operands of `noexcept` are always unevaluated, and we may want to calculate later `noexcept`-expressions for convenience.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs