diff --git a/lib/checkio.cpp b/lib/checkio.cpp index 1bdbba1b7..2df5633bb 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -1389,9 +1389,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings, tempToken->insertToken("a"); tempToken = tempToken->next(); } - if (valuetype->pointer == 0U && valuetype->type <= ValueType::INT) - tempToken->str("int"); - else if (valuetype->type == ValueType::BOOL) + if (valuetype->type == ValueType::BOOL) tempToken->str("bool"); else if (valuetype->type == ValueType::CHAR) tempToken->str("char"); diff --git a/test/testio.cpp b/test/testio.cpp index a9216db12..2f0cf774c 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -2187,6 +2187,12 @@ private: ASSERT_EQUALS("[test.cpp:9]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'int'.\n" "[test.cpp:9]: (warning) %u in format string (no. 2) requires 'unsigned int' but the argument type is 'float'.\n", errout.str()); + // Ticket #7445 + check("struct S { unsigned short x; } s = {0};\n" + "void foo() {\n" + " printf(\"%d\", s.x);\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void testPosixPrintfScanfParameterPosition() { // #4900 - No support for parameters in format strings