Bug 2007 – (D1 only) Appending one element array doesn't compile
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2008-04-18T11:45:28Z
Last change time
2019-05-11T16:58:11Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
Bartosz Milewski
Comments
Comment #0 by bartosz — 2008-04-18T11:45:28Z
I'm working with arrays of arrays of strings, result and ys. I want to append/prepend a one-element array of strings, [y], to ys. Neither compiles.
string y = "a";
string [][] ys = [];
string [][] result = [];
result = ys ~ [y];
result = [y] ~ ys;
test.d(30): Error: incompatible types for ((ys) ~ ([y])): 'invariant(char)[][][]
' and 'invariant(char)[][1u]'
test.d(31): Error: incompatible types for (([y]) ~ (ys)): 'invariant(char)[][1u]
' and 'invariant(char)[][][]'
test.d(31): Error: cannot implicitly convert expression ([y] ~ ys) of type invar
iant(char)[][] to invariant(char)[][][]
Comment #1 by yebblies — 2011-06-10T05:37:58Z
This now works in D2, but still fails in D1 (1.068)
Comment #2 by pro.mathias.lang — 2019-05-11T16:58:11Z