-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
When tidy reports a violations, it looks like
an exception may be thrown in function 'main' which should not throw exceptions [bugprone-exception-escape]
2801 | int main(int argc, char *argv[])
| ^
or
somefile.cpp:2425:11: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
2425 | Data& operator=(Data&&) = default;
It is not so actionable or ergonomic. It is an important finding, must be fixed, but it takes a lot of time to find the cause. One line of a note will save a lot of efforts.
In the last example, I opened CLion, which immediately highlighted the move constructor with a message "Move constructor should be marked noexcept". Simple and clear. Yes, we run tidy with select checks, and performance-noexcept-move-constructor is not in the same group as bugprone-exception-escape.
In the first example, I did not even find the source of an exception, it can be thousands lines of somebody's code. Yes, I know, I can add a big catch and get the source control ownership of all the lines in main function. But it would help if the tool explains its findings.