[Issue 20443] Case where code compiles depending on order of declaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 12 09:04:03 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20443

Daniel X <redapple82570 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redapple82570 at gmail.com

--- Comment #1 from Daniel X <redapple82570 at gmail.com> ---
further reduced, thanks to Paul Backus (author of 'sumtype' who generously
looked into this issue for us)

---
struct SumType(T) {
    import std.traits: isCopyable;
    static if (!isCopyable!T)
        @disable this(this);
}

struct CallbackType1 {
    bool[Class1] func;   // changing to Class1[] compiles OK
}

// moving Class1 above CallbackType1 compiles OK
class Class1 {
    SumType!CallbackType1 _callback;
    this(SumType!CallbackType1 callback) { // commenting out this ctor compiles
OK
        _callback = callback;
    }
}

--


More information about the Digitalmars-d-bugs mailing list