[Issue 259] Comparing signed to unsigned does not generate an error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 10 09:20:29 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=259



--- Comment #45 from Lionello Lunesu <lio+bugzilla at lunesu.com> 2013-04-10 09:20:22 PDT ---
uint b;
if (b > -2) { ... }

The integral expression -2 doesn't have any size per se, but whole size thing
shouldn't even apply here, since the two expressions have ranges that are
completely disjoint. Points 2 and 3 won't catch this case either and would
cause an error. We could consider all integrals 'long' and apply point 1. Or,
test for disjoint ranges and replace the whole comparison with a constant? (I
have a feeling this optimization might already be happening in a later pass?)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list