[Issue 12031] New: Possible dollar handling inconsistencies in std.typecons.Typedef array
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 29 08:28:52 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12031
Summary: Possible dollar handling inconsistencies in
std.typecons.Typedef array
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2014-01-29 08:28:51 PST ---
I am not sure, but perhaps this code shows some inconsistencies:
import std.typecons: Typedef;
ubyte[4] foo1() {
ubyte[25] a;
return a[$ - 4 .. $]; // OK
}
ubyte[4] foo2() {
Typedef!(ubyte[25]) a;
return a[$ - 4 .. $]; // Error
}
ubyte[4] foo3() {
Typedef!(ubyte[25]) a;
return a[a.length - 4 .. a.length]; // Error
}
ubyte[4] foo4() {
Typedef!(ubyte[25]) a;
typeof(return) result;
result[] = a[a.length - 4 .. a.length]; // OK
return result;
}
void main() {}
dmd 2.065beta gives:
test.d(8): Error: undefined identifier __dollar
test.d(8): Error: undefined identifier __dollar
test.d(12): Error: cannot implicitly convert expression (a.opSlice(21u, 25u))
of type ubyte[] to ubyte[4]
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list