Issue 109927
Summary Clang-tidy bugprone-exception-escape only reports directly visible throws
Labels clang-tidy
Assignees
Reporter JVApen
    The clang-tidy check bugprone-exception-escape only considers direct visible throws

For example:
````
void f(bool b) noexcept(false) {
 if (b) throw 1;
}
struct C {
    ~C() { f(true); }
};
````
However, the moment that the implementation of `f` is not available, the check no longer reports a potential problem:
````
void f(bool b) noexcept(false);
struct C {
    ~C() { f(true); }
};
````
(https://compiler-explorer.com/z/aWWbsx7vM)

This function declaration explicitly mentions `noexcept(false)` (aka: this is expected to throw an exception), so it would be safe to also report this as a violation. Without any exception specification, we don't know if the function throws without its body, which might also be a risk. Although as this has been the default for long, this is a situation that shouldn't be reported by default. (Though it could if we introduce a strict-mode)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to