Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
April 18, 2016 [Issue 15938] ctor doesn't initialize fields when struct is static immutable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15938 Mathias Lang <mathias.lang@sociomantic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mathias.lang@sociomantic.co | |m --- Comment #1 from Mathias Lang <mathias.lang@sociomantic.com> --- Might be related to https://issues.dlang.org/show_bug.cgi?id=15607#c5 -- |
September 21, 2016 [Issue 15938] ctor doesn't initialize fields when struct is static immutable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15938 ag0aep6g@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |ag0aep6g@gmail.com -- |
September 21, 2016 [Issue 15938] ctor doesn't initialize fields when struct is static immutable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15938 John Colvin <john.loughran.colvin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |john.loughran.colvin@gmail. | |com --- Comment #2 from John Colvin <john.loughran.colvin@gmail.com> --- Simplified example: struct S { union { // works if order swapped int b; int[1] a; } this(int v) { a[0] = v; } } auto s = S(2); void main() { assert(s.a[0] == 2); // fails assert(S(2).a[0] == 2); // OK } -- |
March 24, 2022 [Issue 15938] ctor doesn't initialize fields when struct is static immutable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15938 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #3 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to John Colvin from comment #2) > Simplified example: > > struct S { > union { > // works if order swapped > int b; > int[1] a; > } > > this(int v) { > a[0] = v; > } > } > auto s = S(2); > > void main() { > assert(s.a[0] == 2); // fails > assert(S(2).a[0] == 2); // OK > } It seems that ctfe rewrites `auto s = S(2)` to `auto s = S(0, [2)`. So it does not seem to understand that a and b are inside a union and therefore only the first initializer (0) will be taken into account. -- |
December 13 [Issue 15938] ctor doesn't initialize fields when struct is static immutable | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15938 --- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17753 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation