It may not be a bug, that's what one could use, albeit there are better ways, to get the upper limit of the unsigned type.
unsigned maxint = -1; // And voila we have the UINT_MAXAlthough, I agree that perhaps a warning is in order, this doesn't seem to be the case with g++ (7.2.x) on my machine. The above line will not generate even a warning and I do compile with -Wall.
like pointing out signed/ unsigned mismatches in if statements etc.
This is when it comes to comparisons, because due to representation (and integral promotion) -1 is the biggest number there possibly can be in a mixed signed-unsigned comparison.
Actually, maybe it did print a warning but OP ignored it, who knows.
It'd depend on the actual compiler, but it might not have warned him.