From 1b8eab638367425a39189382a2540121afc4b4ed Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 5 Jul 2024 12:42:15 +0200 Subject: [PATCH] Update testunusedfunctions.cpp --- test/testunusedfunctions.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testunusedfunctions.cpp b/test/testunusedfunctions.cpp index e0c5e1a5f35..77c68cb546a 100644 --- a/test/testunusedfunctions.cpp +++ b/test/testunusedfunctions.cpp @@ -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__) @@ -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)