And if I run cppcheck -i random_file.h --enable=all --project=all/all-vs2015.sln "--project-configuration=Debug|Win32" "--file-filter=*einrichtaufwand.cpp" I get
ls@ws-dev-ls:~/git_projects/src$cppcheck-irandom_file.h--enable=all --project=all/all-vs2015.sln "--project-configuration=Debug|Win32" "--file-filter=*einrichtaufwand.cpp"cppcheck:filenameexclusiondoesnotapplytoheader(.hand.hpp)files.cppcheck:Pleaseuse--suppress for ignoring results from the header files.Checkinglib/bdelib/haldia/einrichtaufwand.cppDebug|Win32...Checkinglib/bdelib/haldia/einrichtaufwand.cpp:_WIN32=1;__SSE2__=1;HAVE_SNPRINTF=1;BOOST_DATE_TIME_NO_LIB=1;_CRT_SECURE_NO_WARNINGS=1;__SSE2__=1;__SSE2__=1;__SSE2__=1;HAVE_SNPRINTF=1;BOOST_DATE_TIME_NO_LIB=1;_CRT_SECURE_NO_WARNINGS=1;__SSE2__=1;__SSE2__=1;WIN32=1;_DEBUG=1;_WINDOWS=1;__SSE2__=1;_MSC_VER=1900;__AFXWIN_H__=1...lib/bdelib/haldia/einrichtaufwand.cpp:3:24:style:Variable'maschSchichtData'canbedeclaredasreferencetoconst[constVariableReference]for(auto&maschSchichtData:ret)^lib/bdelib/haldia/einrichtaufwand.cpp:1:0:style:Thefunction'test'isneverused.[unusedFunction]voidtest()^nofile:0:0:information:Activecheckers:122/856(use--checkers-report=<filename> to see details) [checkersReport]
style: Variable 'maschSchichtData' can be declared as reference to const is wrong because you can not pass const pointers to std::sort.
If I use std::sort(maschSchichtData.begin(), maschSchichtData.end()); instead I don't get this warning anymore.
Strange things: If I remove -i random_file.h from the command line I don't get this error.
If I use cppcheck -i random_file.h --enable=all lib/bdelib/haldia/einrichtaufwand.cpp I also don't get this error. I don't know why.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have reduced the source file to the following:
And if I run
cppcheck -i random_file.h --enable=all --project=all/all-vs2015.sln "--project-configuration=Debug|Win32" "--file-filter=*einrichtaufwand.cpp"
I getstyle: Variable 'maschSchichtData' can be declared as reference to const
is wrong because you can not pass const pointers to std::sort.If I use
std::sort(maschSchichtData.begin(), maschSchichtData.end());
instead I don't get this warning anymore.Strange things: If I remove
-i random_file.h
from the command line I don't get this error.If I use
cppcheck -i random_file.h --enable=all lib/bdelib/haldia/einrichtaufwand.cpp
I also don't get this error. I don't know why.Tracked in https://trac.cppcheck.net/ticket/11617