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

           Summary: [CTFE] A null pointer '!is null' returns 'true'.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: kenn...@gmail.com


--- Comment #0 from kenn...@gmail.com 2011-07-10 11:15:16 PDT ---
Test case:

------------------------
static assert(!{
    auto p = null;
    return p !is null;
}());
------------------------
x.d(1): Error: static assert  (!true) is false
------------------------

The problem is the strange statement 'cmp ^= -1' in
https://github.com/D-Programming-Language/dmd/blob/master/src/interpret.c#L2338.
When two pointers are both null, 'cmp' will be 1, and 'cmp ^ -1' is -2 which is
also true.

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

Reply via email to