Bug 10646 – No front-end error for invalid casting dynamic array/static array to class reference

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-15T06:31:00Z
Last change time
2015-02-18T03:42:31Z
Keywords
pull
Assigned to
nobody
Creator
henning

Comments

Comment #0 by henning — 2013-07-15T06:31:45Z
void main() { class C { } C[] csd; C[2] css; auto c1 = cast(C)csd; auto c2 = cast(C)css; } --- test.d(6): Error: e2ir: cannot cast csd of type C[] to type test.main.C test.d(7): Error: e2ir: cannot cast css of type C[2LU] to type test.main.C ---
Comment #1 by henning — 2013-07-15T06:36:32Z
Comment #2 by k.hara.pg — 2013-07-15T18:54:52Z
(In reply to comment #0) > void main() { > class C { } > > C[] csd; > C[2] css; > auto c1 = cast(C)csd; > auto c2 = cast(C)css; > } > > --- > test.d(6): Error: e2ir: cannot cast csd of type C[] to type test.main.C > test.d(7): Error: e2ir: cannot cast css of type C[2LU] to type test.main.C > --- I think there's no "Internal Compiler Error". These are proper errors but just come from glue layer.
Comment #3 by github-bugzilla — 2013-07-16T11:36:18Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/450f6cb9c3bfc7697c529a7750e8e2818e8a8a3e fix issue 10646 - [ICE] when casting dynamic array/static array to class reference https://github.com/D-Programming-Language/dmd/commit/20d0bc0226f059d8a6ecf87e48d44c5c50428315 Merge pull request #2348 from hpohl/10646 fix issue 10646 - [ICE] when casting dynamic array/static array to class reference
Comment #4 by k.hara.pg — 2013-11-28T19:53:00Z
*** Issue 7760 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2015-01-14T21:17:08Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2cd314db57f8a2e34cc829ac28e0f4872a7608f1 Check the cast from class type to dynamic or static array type It's a reverse direction of issue 10646 case.
Comment #6 by github-bugzilla — 2015-02-18T03:42:31Z