Thread overview
[Issue 18909] Lambda with default initializer gets called with random values instead
May 26, 2018
ag0aep6g
Apr 27, 2019
Hiroki Noda
Dec 17, 2022
Iain Buclaw
May 26, 2018
https://issues.dlang.org/show_bug.cgi?id=18909

ag0aep6g <ag0aep6g@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g@gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g@gmail.com> ---
Reduced Phobos away:

----
void main() @safe
{
    assert(identity(2) == 2); /* fails; should pass */
}

struct Map(alias fun)
{
    int front() @safe { return fun(); }
}

int identity(immutable int q) pure nothrow @safe @nogc
{
    int getArg(int b) @safe
    {
        return b;
    }
    return Map!((int b = q) => getArg(b))().front();
}
----

--
April 27, 2019
https://issues.dlang.org/show_bug.cgi?id=18909

Hiroki Noda <kubo39@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kubo39@gmail.com

--- Comment #2 from Hiroki Noda <kubo39@gmail.com> ---
This should fail to compile, and in this case you can use `lazy int b = q` and will work.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18909

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
3 days ago
https://issues.dlang.org/show_bug.cgi?id=18909

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19440

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--