I dustmite'd down my problem code, and it seems just changing the order of declarations makes the error go away. Specifically, moving a class declaration from the bottom of the file, to the top, allows it to compile. I also commented on two other things that can be changed to make it work - neither seemingly related to the error at hand.

Just double-checking before I file a bug for this:
--------------------------------------------------
import sumtype;

// DMD 2.089.0-dirty (also v2.087.1)
// app.d(18,13): Error: struct sumtype.SumType!(CallbackType1).SumType is not copyable because it is annotated with @disable

struct Struct1(T) {
    bool[T] items;
}

struct CallbackType1 {
void delegate(Struct1!Class2) func; // changing arg to Class2[] compiles OK
}
alias CallbackType = SumType!CallbackType1;

class Class1 {
    CallbackType _callback;
this(CallbackType callback) { // commenting out this ctor compiles OK
        _callback = callback;
    }
}

// moving Class2 to the top of the file compiles OK
class Class2 {
    Struct1!Class1 subscribers;
}

void main() {}

Reply via email to