example:
#include <stdexcept> #include <cstdio> void testit (bool throw_p){ if (throw_p) throw std::runtime_error("test"); } void test1(){ std::puts("test1"); { testit(false); } try { testit(true); } catch (const std::runtime_error& e){ std::puts("caught exception:"); std::puts(e.what()); } } int main(){ test1(); return 0; }
the code runs and produces output: test1 caught exception: test
i.e. the exception is caught inside the test function as it should be.
However, cppcheck 2.19.1 reports: athena/test.cxx:23:3: error: Unhandled exception thrown in function that is an entry point. [throwInEntryPoint]
athena/test.cxx:23:3: error: Unhandled exception thrown in function that is an entry point. [throwInEntryPoint]
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14399
Log in to post a comment.
example:
the code runs and produces output:
test1
caught exception:
test
i.e. the exception is caught inside the test function as it should be.
However, cppcheck 2.19.1 reports:
athena/test.cxx:23:3: error: Unhandled exception thrown in function that is an entry point. [throwInEntryPoint]Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14399