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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Apr 19 21:03:54 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=259

Jon Degenhardt <jrdemail2000-dlang at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jrdemail2000-dlang at yahoo.co
                   |                            |m

--- Comment #62 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
Hit this in my code. My bug, but would have been useful if the compiler had
informed me there was a signed vs unsigned comparison. Here's the reduced form
of what was happening in my code:

    void main() {
        int i = -1;
        size_t j = 0;
        assert(i < j);
    }

This code compiles, and the assert fails. Except that I didn't have the assert,
just the test.

--


More information about the Digitalmars-d-bugs mailing list