www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1896] New: null literal check does not work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1896

           Summary: null literal check does not work
           Product: D
           Version: 1.028
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de


DMD 1.028 on linux does not issue an error for class types compared against
null literal.


-- 
Mar 07 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1896


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eatingstaples gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2012-01-30 14:56:40 EST ---
*** Issue 6444 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1896


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |FIXED


--- Comment #2 from yebblies <yebblies gmail.com> 2012-01-30 14:58:12 EST ---
Works on current dmd (1.068 & 2.058)

void main()
{
    class C {}
    C c;
    if (c != null) {}
    if (c == null) {}
}

Prints:

testx.d(5): Error: use '!is' instead of '!=' when comparing with null
testx.d(6): Error: use 'is' instead of '==' when comparing with null

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