I used the online demo http://cppcheck.sourceforge.net/demo/ to verify the error.
#include <limits> void f() { ** [[maybe_unused]] auto intCheck = 1 / (std::numeric_limits<int>::is_integer ? 1 : 0); // **(error) Division by zero.** ** [[maybe_unused]] auto intCheck2 = 1 / (true ? 1 : 0); // **NO ERROR** }
Output:
Cppcheck 2.3 [test.cpp:5]: (error) Division by zero. Done!
Thanks! I have created a ticket https://trac.cppcheck.net/ticket/10285
Log in to post a comment.
I used the online demo http://cppcheck.sourceforge.net/demo/ to verify the error.
Output:
Thanks! I have created a ticket https://trac.cppcheck.net/ticket/10285