You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reportError(tok, Severity::error, "throwInNoexceptFunction", "Exception thrown in function declared not to throw exceptions.", CWE398, Certainty::normal);
322
+
reportError(tok, Severity::error, "throwInNoexceptFunction", "Unhandled exception thrown in function declared not to throw exceptions.", CWE398, Certainty::normal);
Copy file name to clipboardExpand all lines: test/testexceptionsafety.cpp
+45-15Lines changed: 45 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,7 @@ class TestExceptionSafety : public TestFixture {
57
57
TEST_CASE(rethrowNoCurrentException2);
58
58
TEST_CASE(rethrowNoCurrentException3);
59
59
TEST_CASE(noFunctionCall);
60
+
TEST_CASE(entryPoint);
60
61
}
61
62
62
63
structCheckOptions
@@ -85,7 +86,7 @@ class TestExceptionSafety : public TestFixture {
85
86
" }\n"
86
87
"};");
87
88
ASSERT_EQUALS("[test.cpp:3:9]: (warning) Class x is not safe, destructor throws exception [exceptThrowInDestructor]\n"
88
-
"[test.cpp:3:9]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
89
+
"[test.cpp:3:9]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
89
90
90
91
check("class x {\n"
91
92
" ~x();\n"
@@ -94,7 +95,7 @@ class TestExceptionSafety : public TestFixture {
94
95
" throw e;\n"
95
96
"}");
96
97
ASSERT_EQUALS("[test.cpp:5:5]: (warning) Class x is not safe, destructor throws exception [exceptThrowInDestructor]\n"
97
-
"[test.cpp:5:5]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
98
+
"[test.cpp:5:5]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
98
99
99
100
// #3858 - throwing exception in try block in destructor.
100
101
check("class x {\n"
@@ -114,7 +115,7 @@ class TestExceptionSafety : public TestFixture {
114
115
" }\n"
115
116
" }\n"
116
117
"}");
117
-
ASSERT_EQUALS("[test.cpp:4:13]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
118
+
ASSERT_EQUALS("[test.cpp:4:13]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
118
119
119
120
// #11031 should not warn when noexcept false
120
121
check("class A {\n"
@@ -347,9 +348,9 @@ class TestExceptionSafety : public TestFixture {
347
348
"void func4() noexcept(false) { throw 1; }\n"
348
349
"void func5() noexcept(true) { func1(); }\n"
349
350
"void func6() noexcept(false) { func1(); }");
350
-
ASSERT_EQUALS("[test.cpp:2:25]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n"
351
-
"[test.cpp:3:31]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n"
352
-
"[test.cpp:5:31]: (error) Exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
351
+
ASSERT_EQUALS("[test.cpp:2:25]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n"
352
+
"[test.cpp:3:31]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n"
353
+
"[test.cpp:5:31]: (error) Unhandled exception thrown in function declared not to throw exceptions. [throwInNoexceptFunction]\n", errout_str());
0 commit comments