I'm getting a warning. Are you passing --inconclusive? test.cpp:5:7: warning: inconclusive: Access of moved variable 's'. [accessMoved] if (s.empty()) { ^
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14934
The second example is covered by https://trac.cppcheck.net/ticket/13774
For the first example, I'm getting two warnings: test.cpp:10:7: warning: inconclusive: Access of moved variable 's'. [accessMoved] if (s.empty()) { ^ test.cpp:8:5: note: Calling std::move(s) f(std::move(s)); ^ test.cpp:10:7: note: Access of moved variable 's'. if (s.empty()) { ^ test.cpp:13:16: warning: Access of moved variable 's'. [accessMoved] std::cout << s << '\n' << std::flush; ^ test.cpp:8:5: note: Calling std::move(s) f(std::move(s)); ^ test.cpp:13:16: note: Access of moved variable 's'....
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14928
See https://trac.cppcheck.net/ticket/11786 and tickets mentioned therein.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14908
OK, thanks.