If I write this function:
void f(unsigned int i) { .. }
and then call it like this:
int main() { f(-1); }
it is allowed by the standard, but it is most probably a risky bug that can cause, for example, a very long runtime (if f tries to loop from i down to 0, for example). However, both clang++ (with std=c++20) and clang-tidy (with checks=*) do not generate any warnings for this code. I find it strange, since they give warnings on much less dangerous issues, such as using "magic numbers" in the code, not using curly braces in an "if" statement, and even putting include statements in a non-standard order.
Is there any reason that passing a negative number as an unsigned int is not considered bug-prone and worthy of warnings by these tools?