Bug 748 – internal error with mixed static / dynamic array

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2006-12-25T20:33:00Z
Last change time
2014-02-15T13:21:11Z
Keywords
ice-on-invalid-code, spec
Assigned to
bugzilla
Creator
wbaxter

Comments

Comment #0 by wbaxter — 2006-12-25T20:33:28Z
This code is incorrect but it shouldn't cause an internal compiler error. void main() { int[2][] a; a ~= [1,2]; // should be a ~= [[1,2]]; } I get: Internal error: ..\ztc\cod1.c 2526
Comment #1 by wbaxter — 2006-12-26T11:53:56Z
On second thought, maybe that should compile. Generally speaking this works: T[] a; T b; a ~= b For instance it's no problem if T is int,float, or any struct, etc. In this case T happens to be int[2], and it crashes the compiler. Anyway, this (concatenating single elements with arrays) is one point on which the spec is notably silent. If the above is not supposed to work, then it is an error for it to work in the case of int, float et al. If it is supposed to work, then it is an error for it not to work for int[2]. Either way the spec should probably be explicit about whether the above is legal.
Comment #2 by thomas-dloop — 2007-01-01T10:35:27Z
Comment #3 by bugzilla — 2007-01-03T22:09:00Z
Fixed DMD 1.00