Comment #0 by stanislav.blinov — 2020-05-29T20:58:37Z
// dmd 2.092
struct Simple {
this(ref scope const Simple) {
assert(0);
}
}
unittest {
auto arr = [ Simple() ];
auto brr = arr.dup; // no assert
}
struct Complicated {
int* ptr;
this (ref scope const Complicated) {
/* ... */
}
}
unittest {
auto arr = [ const(Complicated)() ];
auto brr = arr.dup; // does not compile (only checks for is(const(U) : T))
}
See also https://issues.dlang.org/show_bug.cgi?id=20365
Comment #1 by stanislav.blinov — 2020-06-02T15:12:27Z
Going to upgrade this to critical, seeing as the spec recommends switching to copy ctors, whereas neither the compiler nor the runtime are actually ready for such a switch.
Comment #2 by razvan.nitu1305 — 2020-06-17T08:46:24Z