[Issue 13700] New: Rejected valid conversion from slice to fixed size array
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Nov 8 05:15:37 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13700
Issue ID: 13700
Summary: Rejected valid conversion from slice to fixed size
array
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
I think this whole program should be accepted:
void main() {
int[char[2]] aa;
string s = "hello";
immutable i = 1;
aa[s[i .. i + 2]] = 1; // OK
auto j = 1;
aa[s[j .. j + 2]] = 1; // Error
char[2] aux = s[j .. j + 2];
aa[aux] = 1; // OK
}
DMD 2.067alpha gives:
test.d(7,9): Error: cannot implicitly convert expression
(s[cast(uint)j..cast(uint)(j + 2)]) of type string to char[2]
--
More information about the Digitalmars-d-bugs
mailing list