Skip to content

Commit 474a09b

Browse files
committed
add test
1 parent b702ead commit 474a09b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

test/testfunctions.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class TestFunctions : public TestFixture {
8787
TEST_CASE(checkMissingReturn6); // #13180
8888
TEST_CASE(checkMissingReturn7); // #14370 - FN try/catch
8989
TEST_CASE(checkMissingReturn8);
90+
TEST_CASE(checkMissingReturn9);
9091
TEST_CASE(checkMissingReturnStdInt); // #14482 - FN std::int32_t
9192

9293
// std::move for locar variable
@@ -1936,6 +1937,16 @@ class TestFunctions : public TestFixture {
19361937
ASSERT_EQUALS("", errout_str());
19371938
}
19381939

1940+
void checkMissingReturn9() {
1941+
check("struct S { int v; };\n"
1942+
" S operator/(S x, S y) { return { x.v / y.v }; }\n"
1943+
" S f(int a, int b) {\n"
1944+
" if (b) { return S{ a } / S{ b }; }\n"
1945+
" else { return {}; }\n"
1946+
"}\n");
1947+
ASSERT_EQUALS("", errout_str());
1948+
}
1949+
19391950
void checkMissingReturnStdInt() {// #14482 - FN
19401951
check("std::int32_t f() {}\n");
19411952
ASSERT_EQUALS("[test.cpp:1:19]: (error) Found an exit path from function with non-void return type that has missing return statement [missingReturn]\n", errout_str());

0 commit comments

Comments
 (0)