[Issue 8396] New: wrong order of evaluation for tuple expansion in function arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 17 06:03:37 PDT 2012


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


--- Comment #0 from dawg at dawgfoto.de 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);
}
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: -------


More information about the Digitalmars-d-bugs mailing list