Skip to content

Commit

Permalink
Update testunusedfunctions.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jul 5, 2024
1 parent f133a4f commit 1b8eab6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/testunusedfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class TestUnusedFunctions : public TestFixture {
TEST_CASE(includes);
TEST_CASE(virtualFunc);
TEST_CASE(parensInit);
TEST_CASE(typeInCast;
}

#define check(...) check_(__FILE__, __LINE__, __VA_ARGS__)
Expand Down Expand Up @@ -756,6 +757,18 @@ class TestUnusedFunctions : public TestFixture {
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) The function 'url' is never used.\n", errout_str());
}

void typeInCast()
{
check("struct S {\n" // #12901
" void Type() {}\n"
"};\n"
"int main() {\n"
" struct Type {} t;\n"
" Type t2{ (Type)t };\n"
"}\n");
ASSERT_EQUALS("[test.cpp:2]: (style) The function 'Type' is never used.\n", errout_str());
}
};

REGISTER_TEST(TestUnusedFunctions)

0 comments on commit 1b8eab6

Please sign in to comment.