Thread overview | ||||||
---|---|---|---|---|---|---|
|
October 19, 2014 [Issue 13629] Field postblit can't be generated for const field | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13629 ag0aep6g@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ag0aep6g@gmail.com --- Comment #1 from ag0aep6g@gmail.com --- Same with destructor: struct A { ~this() {} /* Error: mutable method test.B.~this is not callable using a const object */ } struct B {A a;} struct C {const B b;} -- |
October 19, 2014 [Issue 13629] Field postblit can't be generated for const field | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13629 --- Comment #2 from ag0aep6g@gmail.com --- A workaround: struct C { const B[1] b_; @property ref const(B) b() {return b_[0];} } -- |
October 20, 2014 [Issue 13629] Field postblit can't be generated for const field | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13629 Jonathan M Davis <issues.dlang@jmdavisProg.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |issues.dlang@jmdavisProg.co | |m --- Comment #3 from Jonathan M Davis <issues.dlang@jmdavisProg.com> --- As much as this sucks, it really isn't a bug. const and postblits are incompatible by their very nature, because the postblit copies and then mutates, which violates const. So, arguably, going with postblit constructors over copy constructors was a mistake. There's a DIP that tries to fix the problem ( http://wiki.dlang.org/DIP49 ), but it was deemed to be way too complicated. This is a design problem in the language that needs to be fixed (possibly by adding copy constructors) and not a bug in the compiler. It is expected behavior at this point. -- |
June 10, 2021 [Issue 13629] Field postblit can't be generated for const field | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13629 moonlightsentinel@disroot.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |moonlightsentinel@disroot.o | |rg Resolution|--- |WORKSFORME --- Comment #4 from moonlightsentinel@disroot.org --- The first example works since 2.067.1, the latter with 2.068.2 (according to run.dlang.io) -- |
Copyright © 1999-2021 by the D Language Foundation