Bug 20957 – void member initialisation is ignored for out struct parameters

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-19T07:43:46Z
Last change time
2024-12-13T19:09:28Z
Assigned to
No Owner
Creator
Илья Ярошенко
Moved to GitHub: dmd#19727 →

Comments

Comment #0 by ilyayaroshenko — 2020-06-19T07:43:46Z
struct A { bool sign; int length; size_t[256] data = void; } void foo(out A a) { } void example.foo(out example.A): mov edx, 2056 xor esi, esi jmp memset@PLT
Comment #1 by look.at.me.pee.please — 2020-06-19T15:06:10Z
Void initializers on structs don't do what you think they do. The whole structure gets memcpy'd from the .init struct data. It just allows the compiler to insert whatever it wants for the data that is void initialized in the .init data.
Comment #2 by robert.schadek — 2024-12-13T19:09:28Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19727 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB