File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1555,7 +1555,7 @@ void CheckOther::checkConstPointer()
15551555 continue ;
15561556 if (!tok->valueType ())
15571557 continue ;
1558- if (tok->valueType ()->pointer == 0 || (tok->valueType ()->constness & 1 ))
1558+ if (tok->valueType ()->pointer != 1 || (tok->valueType ()->constness & 1 ) || tok-> valueType ()-> reference != Reference::None )
15591559 continue ;
15601560 if (nonConstPointers.find (tok->variable ()) != nonConstPointers.end ())
15611561 continue ;
Original file line number Diff line number Diff line change @@ -3035,6 +3035,20 @@ class TestOther : public TestFixture {
30353035 " if (p == nullptr) {}\n "
30363036 " }\n " );
30373037 ASSERT_EQUALS (" " , errout.str ());
3038+
3039+ check (" void g(int*);\n "
3040+ " void f(int* const* pp) {\n "
3041+ " int* p = pp[0];\n "
3042+ " g(p);\n "
3043+ " }\n " );
3044+ ASSERT_EQUALS (" " , errout.str ());
3045+
3046+ check (" template <typename T>\n "
3047+ " struct S {\n "
3048+ " static bool f(const T& t) { return t != nullptr; }\n "
3049+ " };\n "
3050+ " S<int*> s;\n " );
3051+ ASSERT_EQUALS (" " , errout.str ());
30383052 }
30393053
30403054 void switchRedundantAssignmentTest () {
@@ -9150,7 +9164,7 @@ class TestOther : public TestFixture {
91509164 " int local_argc = 0;\n "
91519165 " local_argv[local_argc++] = argv[0];\n "
91529166 " }\n " , " test.c" );
9153- ASSERT_EQUALS (" [test.c:1]: (style) Parameter 'argv' can be declared with const \n " , errout.str ());
9167+ ASSERT_EQUALS (" " , errout.str ());
91549168
91559169 check (" void f() {\n "
91569170 " int x = 0;\n "
You can’t perform that action at this time.
0 commit comments