Thread overview
[Issue 19938] CTFE duplicates calls to function when it is used as LHS of slice assignment
Jun 04, 2019
ag0aep6g
Jun 05, 2019
Eyal
Dec 17, 2022
Iain Buclaw
June 04, 2019
https://issues.dlang.org/show_bug.cgi?id=19938

ag0aep6g <ag0aep6g@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g@gmail.com
           Severity|enhancement                 |normal

--
June 05, 2019
https://issues.dlang.org/show_bug.cgi?id=19938

--- Comment #1 from Eyal <eyal@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());
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19938

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--