cppcheck 2.21.0 generates knownConditionTrueFalse for the following code:
class A { public: template<typename T> static bool get(T*) { return false; } template<> static bool get<int>(int*) { return true; } }; class B { public: template<typename T> static bool get(T* ptr) { return A::get(ptr); } };
cppcheck.exe -q --enable=all . test\main.cpp:22:16: style: Return value 'A::get(ptr)' is always false [knownConditionTrueFalse] return A::get(ptr); ^ test\main.cpp:22:16: note: Calling function 'get' returns 0 return A::get(ptr); ^ test\main.cpp:22:16: note: Return value 'A::get(ptr)' is always false return A::get(ptr); ^
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14819
Log in to post a comment.
cppcheck 2.21.0 generates knownConditionTrueFalse for the following code:
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/14819