[Issue 14672] New: Internal error: e2ir.c 4620 When copying array of derived class to an array of base class
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Jun 9 11:55:50 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14672
Issue ID: 14672
Summary: Internal error: e2ir.c 4620 When copying array of
derived class to an array of base class
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: petar.p.kirov at gmail.com
To reproduce:
class B {}
class D : B {}
void main()
{
D[] arr_d;
B[] arr_b;
arr_b[] = arr_d[]; // Internal error: e2ir.c 4620
arr_b = cast(B[])arr_d; // Requires cast, cuz of
arr_b = arr_d; // "Error: cannot implicitly
// convert expression (arr_d) of type D[] to B[]"
D d = new D();
arr_b = [d]; // This does work as expected
}
Tested in DMD64 D Compiler v2.067.1 on Linux.
--
More information about the Digitalmars-d-bugs
mailing list