Issue 152477
Summary confusing `-Wunreachable-code` calling a `[[noreturn]]` function with a non-POD return type
Labels clang:diagnostics
Assignees
Reporter firewave
    ```cpp
#include <stdexcept>
#include <string>

[[noreturn]] int func();
[[noreturn]] std::string err();

void f(int i)
{
    if (i == 0) {
    }
    else if (i == 1) {
        func();
    }
    else {
        err();
 }
}
```

```
<source>:15:9: warning: code will never be executed [-Wunreachable-code]
   15 |         err();
      | ^~~~~
```

https://godbolt.org/z/ffKzT8MfP
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to