Thread overview | |||||
---|---|---|---|---|---|
|
December 08, 2021 [Issue 13119] `struct` constructor attributes inferred like field destructor is called on initialization | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13119 Stanislav Blinov <stanislav.blinov@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stanislav.blinov@gmail.com --- Comment #1 from Stanislav Blinov <stanislav.blinov@gmail.com> --- Error in the original report is trivially worked around by replacing `s = S(0)` with `s = 0` as that is supported by S's constructor. However, the error comes back as soon as more than one argument gets involved: struct S { this(int, int) @safe pure nothrow @nogc { } ~this() { } } struct T { S s; this(int) @safe pure nothrow @nogc { s = S(0, 1); // attribute errors here as this is introducing a dtor call } } Two workarounds: alias AliasSeq(T...) = T; s = AliasSeq!(0, 1); // works for literals, not for moving stuff import core.lifetime : forward; s = forward!args; // works for moving and copying, but not for literals Observation about `nothrow` not being looked at is still valid. Initialization shouldn't require a destructor call, as right hand side should ostensibly be constructed at &s, should it not? -- |
December 17, 2022 [Issue 13119] `struct` constructor attributes inferred like field destructor is called on initialization | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13119 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 13119] `struct` constructor attributes inferred like field destructor is called on initialization | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13119 --- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18849 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation