Postblit segfault.
Ferhat Kurtulmuş
aferust at gmail.com
Mon Jun 1 09:30:41 UTC 2020
On Monday, 1 June 2020 at 06:35:36 UTC, MaoKo wrote:
> Hello, I don't understand why this code segfault on
> Linux/FreeBSD:
>
> import std.stdio;
> struct _Poc {
> this(this) { writeln("_Poc.this(this)"); }
> }
> void main() {
> _Poc[1] valueArray = [ _Poc() ];
> writeln(valueArray);
> }
>
> I've just defined the postblit function in _Poc to see how much
> it's invoked.
> In my system, it's invoked 3 time after the segfault.
> When the array is allocated on the heap, nothing happen.
> So I guess it's because it's located on the stack but why?
>
> regard.
I cannot help much, but I can say that problem is not about
postblit. I tried running the code on https://run.dlang.io/. It
works with LDC but not with DMD. Even though postblit is removed,
it crashes because there may be a bug with DMD's writeln or there
is something more that I missed too.
More information about the Digitalmars-d-learn
mailing list