[Issue 19938] CTFE duplicates calls to function when it is used as LHS of slice assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 5 07:45:13 UTC 2019


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

--- Comment #1 from Eyal <eyal at weka.io> ---
Slightly simplified:

auto check() {
    int count;
    int[] x() { count++; return []; }
    x()[] = 1;
    assert(count == 1); // fails in CTFE only, where count == 2, LHS calls are
duplicated in CTFE
    return true;
}

unittest {
    cast(void)check(); // works
    static assert(check());
}

--


More information about the Digitalmars-d-bugs mailing list