<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/125759>125759</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang false -Wtautological-unsigned-zero-compare warning.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pawelsopensource
</td>
</tr>
</table>
<pre>
Hi, The following code triggers false positive warning about comparison < 0. The 'if limit ' shortcuts expression evaluation.
```
static constexpr unsigned limit = 0;
bool check( unsigned x ) {
if ( limit && ( x < limit ) )
return false;
return true;
}
error: result of comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-unsigned-zero-compare]
if ( limit && ( x < limit ) )
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUUsGOmzAQ_RpzGYGMCQEOHLIbRf2ASns2MIBbh0EeO9nt11cmQZtjiwaBxu-9eX4azWymBbEV5Zsoz4kOfibXrvqOlmnFhSm4HpOOhq_2hxHqHX7OCCNZS3ezTNDTgOCdmSZ0DKO2jLASG29uCHftlgjSHQUPPV1X7QzTAqJ4B5ltUkJVZgRrrsbHf-CZnO-DZ8DP1SGzoQXwpm3Q3tCSCXmKdZTPkif22pseelrYRw6EZbvUsKsWZ5CieHswOyIL_Yz9b6Hqb-gnCNWAqCIKAMCMEM93X0ehjlvjc_O-t5v4PhnxceiDWx4xPCa-dL0Lz6aozg8z6Bw5UZzAIQfrgcbXlGj89vcSxhYeGAZt7_prD12Ub-nHQ0-9px9eB0-WJtNrm-4q6R90lD4moCjPu_P_uGwytMXQFI1OsM2roq5kXlUymdtKdbnsOp1j3tRN02k8Iqoay2NeN3joEtMqqUqp5CFWKTOJB1V2Q1HIYcS6RnGQeNXGZtberhm5KTHMAdtclVXZJFZ3aHlbVKV6q5dJKBV31rWRkHZhYnGQ1rDnbwlvvMV2gz-D-pds9s3NkuBsO3u_sihOQl2EukzGz6HLeroKdYlznp90dfQLey_UZfPNQl2e1m-t-hsAAP__UncWgQ">