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

Simen Kjaeraas <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Simen Kjaeraas <[email protected]> ---
A slightly more elucidating example:

struct B {
    static int value = 77;
    alias value this;

    int i = 13;

    this(ref B rhs) { }
}

void test(ref int x, ref B b) {
    import std.stdio : writeln;
    writeln("x: ", &x, " = ", x);
    writeln("b: ", &b);
}

unittest {
    B b;
    test(b, b);
}

x is now consistently 13, and &x == &b. IOW, alias this is somehow forgetting
that value is a static field, and treats it as non-static.

--

Reply via email to