[Issue 14227] New: Incorrect passed a delegate as argument with null value.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 26 11:41:51 PST 2015


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

          Issue ID: 14227
           Summary: Incorrect passed a delegate as argument with null
                    value.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: alexey.poryadin at gmail.com

import std.stdio;

class Class
{
    void set(int a, double b, void delegate(int revents) callback)
    {
        writefln("(callback !is null) %s", (callback !is null));
    }
}

void main()
{
    auto c = new Class;
    c.set(1, 1, null); // prints: (callback !is null) true
    c.set(1, 1, null); // prints: (callback !is null) false
}
-----
Very strange. It dependent on previous argument number and types. For example
if they both has type int, it work correct.

DMD64 D Compiler v2.066.1
Linux desktop 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015
x86_64 x86_64 x86_64 GNU/Linux

--


More information about the Digitalmars-d-bugs mailing list