File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1947,6 +1947,10 @@ void CheckOther::checkConstPointer()
19471947 continue ;
19481948 if (mSettings ->library .isFunctionConst (parent->astOperand2 ()))
19491949 continue ;
1950+ if (parent->astOperand2 ()->varId ()) {
1951+ if (gparent->str () == " ?" && astIsLHS (parent))
1952+ continue ;
1953+ }
19501954 }
19511955 }
19521956 if (hasIncDecPlus) {
Original file line number Diff line number Diff line change @@ -4817,6 +4817,12 @@ class TestOther : public TestFixture {
48174817 " return bar = 0;\n"
48184818 "}\n");
48194819 ASSERT_EQUALS("", errout_str());
4820+
4821+ check("struct S { int x; };\n" // #14700
4822+ "int f(S* s) {\n"
4823+ " return s->x ? 1 : 0;\n"
4824+ "}\n");
4825+ ASSERT_EQUALS("[test.cpp:2:10]: (style) Parameter 's' can be declared as pointer to const [constParameterPointer]\n", errout_str());
48204826 }
48214827
48224828 void constArray() {
You can’t perform that action at this time.
0 commit comments