Issue 173234
Summary [clang-tidy] `bugprone-exception-escape.IgnoredExceptions` does not ignore after std::format
Labels clang-tidy
Assignees
Reporter pascal-hari
    The check option `bugprone-exception-escape.IgnoredExceptions` does not work as expected when the exception is thrown after the usage of `std::format`.
One expects that those passed to `IgnoredExceptions` are ignored which is not always the case (see example).

Clang-tidy version: Ubuntu LLVM version 18.1.3

**Example to reproduce:**

[main.cpp](https://github.com/user-attachments/files/24288856/main.cpp)

Running clang tidy with the following command:

`clang-tidy main.cpp -checks='bugprone-exception-escape' -config="{CheckOptions: {bugprone-exception-escape.IgnoredExceptions: 'runtime_error'}}" -- -std=c++20`

Reports:
 ```
1 warning generated.
main.cpp:12:5: warning: an exception may be thrown in function '~Foo' which should not throw exceptions [bugprone-exception-escape]
   12 |     ~Foo() { throw_runtime_error("Error in destructor."); }
      |     ^
```

Even though `runtime_error` is listed as `IgnoredExceptions`.

Toggle the define at line 4 of `main.cpp` to see the `IgnoredExceptions` working as expected.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to