On Thursday, 31 January 2019 at 02:10:05 UTC, Manu wrote:
I still can't see a truck-sized hole.

I don't know if it's truck-sized, but here's another corner case:

    int doubleMyValue(ref int x) {
        x *= 2;
        return x;
    }

    Point pt;
    pt.x = 5;
    pt.y = foobar();

    doubleMyValue(pt.x);
    assert(pt.x == 10);

Question: in the above code, will the assertion pass?

Answer: it depends on Point's implementation. If x is a member variable, then yes. If it's a getter, then doubleMyValue will take a rvalue and x won't be mutated and the assertion will fail.

I think this is a non-trivial conceptual problem.

Reply via email to