Summary: wrong order of evaluation for tuple expansion in
                    function arguments
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from 2012-07-17 06:03:32 PDT ---
cat > bug.d << CODE
struct Tuple { int _a, _b; }
Tuple foo() { return Tuple(1, 2); }

extern(C) int bar(int a, int b)
    return b - a;

void main()
    assert(bar(foo().tupleof) == 1);

dmd -run bug


Arguments for extern(C) function are currently evaluated from right to left
(Bug 6620). The temporary for the result of foo is evaluated with the leftmost
argument, therefore the second argument is uninitialized when calling an
extern(C) function.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to