Postblit segfault.

MaoKo maoko at riseup.net
Mon Jun 1 06:35:36 UTC 2020


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.


More information about the Digitalmars-d-learn mailing list