← Back to index
|
Original Bugzilla link
Bug 20633 – Struct literals order of evaluation is definition dependent, not call dependent
Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-03-04T02:23:10Z
Last change time
2024-12-13T19:07:24Z
Assigned to
No Owner
Creator
Mathias LANG
See also
https://issues.dlang.org/show_bug.cgi?id=21076
Moved to GitHub: dmd#19672 →
Comments
Comment #0
by pro.mathias.lang — 2020-03-04T02:23:10Z
``` struct Test { uint a; uint b; uint c; } void main() { auto s = get(); Test local = { c: 1, a: 2, b: 3 }; assert(s == local); } Test get () { uint x; Test lit = { c: ++x, a: ++x, b: ++x, }; return lit; } ``` With `dmd -checkaction=context -run bar.d`: ```
[email protected]
(12): Test(1, 2, 3) !is Test(2, 3, 1) ---------------- ??:? _d_assert_msg [0x1027b354a] ??:? _Dmain [0x1027a5e5d] ``` I don't see it being referenced anywhere and it sort-of defeats the purpose of different ordering.
Comment #1
by robert.schadek — 2024-12-13T19:07:24Z
THIS ISSUE HAS BEEN MOVED TO GITHUB
https://github.com/dlang/dmd/issues/19672
DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB