struct Foo { int i{}; Foo& operator ++() { ++i; return *this; } // prefix Foo operator ++(int) { Foo f = *this; ++(*this); return f; } // postfix };
Calling v2.3 with "c:\Program Files\Cppcheck\cppcheck.exe" --enable=all --inconclusive foo.cpp results in
"c:\Program Files\Cppcheck\cppcheck.exe" --enable=all --inconclusive foo.cpp
foo.cpp:5:6: style:inconclusive: Technically the member function 'Foo::operator++' can be const. [functionConst] Foo operator ++(int) { Foo f = *this; ++(*this); return f; } // postfix ^
Apparently, the call to the non-const prefix operator++ is not recognized.
Thanks! I can reproduce. I have created https://trac.cppcheck.net/ticket/10077
Log in to post a comment.
Calling v2.3 with
"c:\Program Files\Cppcheck\cppcheck.exe" --enable=all --inconclusive foo.cpp
results inApparently, the call to the non-const prefix operator++ is not recognized.
Thanks! I can reproduce. I have created https://trac.cppcheck.net/ticket/10077