www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8396] New: wrong order of evaluation for tuple expansion in function arguments

http://d.puremagic.com/issues/show_bug.cgi?id=8396

           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
        AssignedTo: nobody puremagic.com
        ReportedBy: dawg dawgfoto.de



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);
}
CODE

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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 17 2012