Issue 109587
Summary `bugprone-exception-escape` reported for generic code with `libc++`
Labels libc++, clang-tidy
Assignees
Reporter firewave
    ```cpp
#include <functional>

struct OnExit {
    std::function<void()> f;

 ~OnExit() {
        f();
 }
};
```

```
<source>:6:5: warning: an exception may be thrown in function '~OnExit' which should not throw exceptions [bugprone-exception-escape]
    6 |     ~OnExit() {
      | ^
```

https://godbolt.org/z/PG8M7jeE9

This is reported for any file which includes it (even when unused) when using `libc++`. There is no warning with `libstdc++`.

First I think this should only be reported when it is used. And second as you cannot annotate the function with `noexcept` it should only be reported when the provided function does not throw an exception.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to