[Issue 18909] Lambda with default initializer gets called with random values instead
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sat May 26 16:37:31 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=18909
ag0aep6g <ag0aep6g at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g at gmail.com
--- Comment #1 from ag0aep6g <ag0aep6g at 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();
}
----
--
    
    
More information about the Digitalmars-d-bugs
mailing list