@@ -1452,6 +1452,21 @@ class TestIO : public TestFixture {
14521452 " [test.cpp:5]: (warning) %s in format string (no. 1) requires 'char *' but the argument type is 'std::string'.\n "
14531453 " [test.cpp:7]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'char *'.\n " , errout.str ());
14541454
1455+ check (" void foo(char* s, const char* s2, std::string s3, int i) {\n "
1456+ " printf(\" %jd\" , s);\n "
1457+ " printf(\" %ji\" , s);\n "
1458+ " printf(\" %ju\" , s2);\n "
1459+ " printf(\" %jo\" , s3);\n "
1460+ " printf(\" %jx\" , i);\n "
1461+ " printf(\" %jX\" , i);\n "
1462+ " }" );
1463+ ASSERT_EQUALS (" [test.cpp:2]: (warning) %jd in format string (no. 1) requires 'intmax_t' but the argument type is 'char *'.\n "
1464+ " [test.cpp:3]: (warning) %ji in format string (no. 1) requires 'intmax_t' but the argument type is 'char *'.\n "
1465+ " [test.cpp:4]: (warning) %ju in format string (no. 1) requires 'uintmax_t' but the argument type is 'const char *'.\n "
1466+ " [test.cpp:5]: (warning) %jo in format string (no. 1) requires 'uintmax_t' but the argument type is 'std::string'.\n "
1467+ " [test.cpp:6]: (warning) %jx in format string (no. 1) requires 'uintmax_t' but the argument type is 'signed int'.\n "
1468+ " [test.cpp:7]: (warning) %jX in format string (no. 1) requires 'uintmax_t' but the argument type is 'signed int'.\n " , errout.str ());
1469+
14551470 check (" void foo(const int* cpi, const int ci, int i, int* pi, std::string s) {\n "
14561471 " printf(\" %n\" , cpi);\n "
14571472 " printf(\" %n\" , ci);\n "
0 commit comments