I am trying to translate some c code into d, get this error:
struct A {
void* sub;
}
struct B {
void* subs;
}
__gshared {
const A[1] a0 = [
{ &b1_ptr },
];
const A[2] a1 = [
{ &b1_ptr },
];
const B b1 = {a1.ptr};
const b1_ptr = &b1;
const A[1] a2 = [
{ &b1_ptr },
];
const B b2 = {a2.ptr};
const b2_ptr = &b2;
}
Error: circular reference to variable `tests.b1_ptr`
If I move a0
after b2_ptr
, no error any more.
The c code has circular reference type, and compile ok. and there is a lot type I am not able to adjust order by hand to guess right order.
the translate code still need to work with C interface, so I can not change the struct layout. is this a bug of d?