File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1781,6 +1781,8 @@ bool Library::isFunctionConst(const Token *ftok) const
17811781 const Yield yield = astContainerYield (ftok->astParent ()->astOperand1 (), *this );
17821782 if (yield == Yield::EMPTY || yield == Yield::SIZE || yield == Yield::BUFFER_NT )
17831783 return true ;
1784+ if ((yield == Yield::START_ITERATOR || yield == Yield::END_ITERATOR ) && ftok->str ()[0 ] == ' c' )
1785+ return true ;
17841786 }
17851787 return false ;
17861788 }
Original file line number Diff line number Diff line change @@ -4867,6 +4867,11 @@ class TestOther : public TestFixture {
48674867 ASSERT_EQUALS("[test.cpp:1:12]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n"
48684868 "[test.cpp:1:20]: (style) Parameter 'q' can be declared as pointer to const [constParameterPointer]\n",
48694869 errout_str());
4870+
4871+ check("int f(std::vector<int>* p) {\n" // #14810
4872+ " return *p->cbegin();\n"
4873+ "}\n");
4874+ ASSERT_EQUALS("[test.cpp:1:25]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str());
48704875 }
48714876
48724877 void constArray() {
You can’t perform that action at this time.
0 commit comments