I encounter a case where cppcheck complain about a unsignedLessThanZero in a bit of code that is (for this case) in the code block of a constexpr false if:
(real code is templated and the type can be signed).
While it is true that, out of context, u32 < 0 should return this issue, I would expect if constexpr (false) {} to behave like #if 0 \ #endif and don't have this bit of code analyzed.
I made this topic about unsignedLessThanZero but it is probably a wider issue of handling constexpr.
I see this issue with both 2.10, 2.13.2 and current head of main (bef9e73e60a61a382f4341cfb70730ea67948132).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I encounter a case where cppcheck complain about a
unsignedLessThanZeroin a bit of code that is (for this case) in the code block of a constexpr false if:(real code is templated and the type can be signed).
While it is true that, out of context,
u32 < 0should return this issue, I would expectif constexpr (false) {}to behave like#if 0 \ #endifand don't have this bit of code analyzed.I made this topic about
unsignedLessThanZerobut it is probably a wider issue of handlingconstexpr.I see this issue with both 2.10, 2.13.2 and current head of main (bef9e73e60a61a382f4341cfb70730ea67948132).
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12387