www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21402] New: Operator evaluation

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

          Issue ID: 21402
           Summary: Operator evaluation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: alex sunopti.com

I translated
https://github.com/dlang/dmd/blob/a9e5b0db723f8edaf80df28f93257edf06d3f17b/test/runnable/evalorder.d#L59-L61
to work with ~= operator.

during discussion of https://github.com/dlang/dlang.org/pull/2881

auto mul11ret3(T)(ref T s)
{
    s ~= 11;
    return [3];
}

void main()
{
        static auto test3(int[] val) { (val ~= 7) ~= mul11ret3(val); return
val; }

        assert(test3([2]) == [2,7,11,3]);
}

dmd on "your code here" failed with [2,11,7]

--
Nov 18 2020