[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 9 21:24:25 UTC 2018


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

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #3 from ag0aep6g at gmail.com ---
Very similar case:

----
struct S {}

S f(ref int i)
{
    ++i;
    return S();
}

void main()
{
    int i = 2;
    assert(f(i) == S());
    assert(i == 3); // fails, i = 2
}
----

With the enum, the struct doesn't have to be empty, but here it does.

--


More information about the Digitalmars-d-bugs mailing list