@@ -3298,15 +3298,15 @@ class TestOther : public TestFixture {
32983298 " for (const auto& h : v)\n "
32993299 " if (h) {}\n "
33003300 " }\n " );
3301- TODO_ASSERT_EQUALS (" [test.cpp:5]: (style) Variable 'h' can be declared as pointer to const\n " , " " , errout.str ());
3301+ ASSERT_EQUALS (" [test.cpp:5]: (style) Variable 'h' can be declared as pointer to const\n " , errout.str ());
33023302
33033303 check (" void f(const std::vector<int*>& v) {\n "
33043304 " for (const auto& p : v)\n "
33053305 " if (p == nullptr) {}\n "
33063306 " for (const auto* p : v)\n "
33073307 " if (p == nullptr) {}\n "
33083308 " }\n " );
3309- TODO_ASSERT_EQUALS (" [test.cpp:2]: (style) Variable 'p' can be declared as pointer to const\n " , " " , errout.str ());
3309+ ASSERT_EQUALS (" [test.cpp:2]: (style) Variable 'p' can be declared as pointer to const\n " , errout.str ());
33103310
33113311 check (" void f(std::vector<int*>& v) {\n "
33123312 " for (const auto& p : v)\n "
@@ -3318,10 +3318,9 @@ class TestOther : public TestFixture {
33183318 " for (const int* p : v)\n "
33193319 " if (p == nullptr) {}\n "
33203320 " }\n " );
3321- TODO_ASSERT_EQUALS (" [test.cpp:1]: (style) Parameter 'v' can be declared as reference to const\n "
3322- " [test.cpp:2]: (style) Variable 'p' can be declared as pointer to const\n " ,
3323- " [test.cpp:1]: (style) Parameter 'v' can be declared as reference to const\n " ,
3324- errout.str ());
3321+ ASSERT_EQUALS (" [test.cpp:1]: (style) Parameter 'v' can be declared as reference to const\n "
3322+ " [test.cpp:2]: (style) Variable 'p' can be declared as pointer to const\n " ,
3323+ errout.str ());
33253324
33263325 check (" void f(std::vector<const int*>& v) {\n "
33273326 " for (const auto& p : v)\n "
@@ -3511,6 +3510,18 @@ class TestOther : public TestFixture {
35113510 " g(c);\n "
35123511 " }\n " );
35133512 ASSERT_EQUALS (" [test.cpp:3]: (style) Parameter 'c' can be declared as pointer to const\n " , errout.str ());
3513+
3514+ check (" typedef void (*cb_t)(int*);\n " // #11674
3515+ " void cb(int* p) {\n "
3516+ " if (*p) {}\n "
3517+ " }\n "
3518+ " void g(cb_t);\n "
3519+ " void f() {\n "
3520+ " g(cb);\n "
3521+ " }\n " );
3522+ ASSERT_EQUALS (" [test.cpp:7] -> [test.cpp:2]: (style) Parameter 'p' can be declared as pointer to const. "
3523+ " However it seems that 'cb' is a callback function, if 'p' is declared with const you might also need to cast function pointer(s).\n " ,
3524+ errout.str ());
35143525 }
35153526
35163527 void switchRedundantAssignmentTest () {
0 commit comments