@@ -32,6 +32,7 @@ class TestIO : public TestFixture {
3232 void run () {
3333 LOAD_LIB_2 (settings.library , " std.cfg" );
3434 LOAD_LIB_2 (settings.library , " windows.cfg" );
35+ LOAD_LIB_2 (settings.library , " qt.cfg" );
3536
3637 TEST_CASE (coutCerrMisusage);
3738
@@ -57,6 +58,8 @@ class TestIO : public TestFixture {
5758 TEST_CASE (testMicrosoftSecurePrintfArgument);
5859 TEST_CASE (testMicrosoftSecureScanfArgument);
5960
61+ TEST_CASE (testQStringFormatArguments);
62+
6063 TEST_CASE (testTernary); // ticket #6182
6164 TEST_CASE (testUnsignedConst); // ticket #6132
6265
@@ -2819,6 +2822,14 @@ class TestIO : public TestFixture {
28192822 ASSERT_EQUALS (" " , errout.str ());
28202823 }
28212824
2825+ void testQStringFormatArguments () {
2826+ check (" void foo(float f) {\n "
2827+ " QString string;\n "
2828+ " string.sprintf(\" %d\" , f);\n "
2829+ " }" , false , false , Settings::Win32A);
2830+ ASSERT_EQUALS (" [test.cpp:3]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'float'.\n " , errout.str ());
2831+ }
2832+
28222833 void testTernary () { // ticket #6182
28232834 check (" void test(const std::string &val) {\n "
28242835 " printf(\" %s\n\" , val.empty() ? \" I like to eat bananas\" : val.c_str());\n "
0 commit comments