[Issue 22601] New: Slice assignment not working for compatible types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 15 06:05:29 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22601
Issue ID: 22601
Summary: Slice assignment not working for compatible types
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: rumbu at rumbu.ro
struct A
{
int x;
void opAssign(B b)
{
this.x = b.y;
}
}
struct B { int y; }
A[] bufa;
B[] bufb;
bufa[0] = bufb[0];
//this works calling bufa[0].opAssign(bufb[0])
bufa[] = bufb[];
//cannot implicitly convert expression `bufb[]` of type `B[]` to `A[]`
Since element assignment is possible, it's supposed that slice assignment to be
allowed to.
--
More information about the Digitalmars-d-bugs
mailing list