Bug 1896 – null literal check does not work

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2008-03-07T10:51:00Z
Last change time
2015-06-09T05:11:39Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
benoit

Comments

Comment #0 by benoit — 2008-03-07T10:51:23Z
DMD 1.028 on linux does not issue an error for class types compared against null literal.
Comment #1 by yebblies — 2012-01-29T19:56:40Z
*** Issue 6444 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2012-01-29T19:58:12Z
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