https://issues.dlang.org/show_bug.cgi?id=20879
Issue ID: 20879
Summary: Arrays are oblivious to copy constructors
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: [email protected]
Reporter: [email protected]
// 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
--