After a long fiddling with a code that won't compile I've got this test case:
struct Foo {
this(ref return scope Foo rhs) {}
~this() {}
}
struct Bar {
@disable this(this);
Foo[2] foos;
}
extern (C)
void main() {}
When built with -betterC
switch (dmd as ldc2 works with it).
I get just:
Error: `TypeInfo` cannot be used with -betterC
Well imagine getting this useful info in a large codebase :/
Anyway, I've traced the problem by custom built dmd using printf
logging here: https://github.com/dlang/dmd/blob/a6f49dade85452d61d9ebcf329e2567ecacd5fab/src/dmd/e2ir.d#L2606
So it somehow tries to generate _d_arrayctor
for the static array.
I've tried to add = void
to the array, but it doesn't help.
Is it a bug (probably is) and are there any workaround for this?
If I remove copy constructor or destructor form Foo
, it compiles. But I need them there..
BetterC is great, but a bit of a minefield to use.