Bug 8396 – wrong order of evaluation for tuple expansion in function arguments

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-17T06:03:00Z
Last change time
2013-11-25T08:20:09Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2012-07-17T06:03:32Z
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.
Comment #1 by k.hara.pg — 2013-11-25T06:57:37Z
Comment #2 by github-bugzilla — 2013-11-25T08:19:52Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8d5517f464d1436070146b9351a6013a6a1bb6ae fix Issue 8396 - wrong order of evaluation for tuple expansion in function arguments https://github.com/D-Programming-Language/dmd/commit/bab3675b9b061b701648b5b32b002a1072f288f8 Merge pull request #2880 from 9rnsr/fix8396 Issue 8396 - wrong order of evaluation for tuple expansion in function arguments