On Monday, 6 August 2018 at 19:17:58 UTC, nkm1 wrote:
On Monday, 6 August 2018 at 18:22:24 UTC, vit wrote:
Hello,
I have this struct:
struct S{
uint kind;
void[N] data_;
}
Instances of struct S are allocated by standard GC new and
S.data_ can contain pointers/ranges to GC allocated data.
If is GC disabled then program run fine. But when is GC
enabled then it fail randomly.
If the definition of S look like this:
struct S{
void[N] data_;
uint kind;
}
then program run fine with GC.enable.
Whats the problem? Something with alignment?
Probably. Try something like:
struct S
{
uint kind;
align((void *).alignof) void[N] data_;
}
And see if it solves the problem.
align((void *).alignof) work, thanks.