[Issue 2777] New: alias this doesn't forward __dollar and slice op.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 1 06:51:41 PDT 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2777
Summary: alias this doesn't forward __dollar and slice op.
Product: D
Version: 2.027
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: dsimcha at yahoo.com
import std.stdio;
struct ArrayWrapper(T) {
T[] array;
alias array this;
}
void main() {
ArrayWrapper!(uint) foo;
foo.length = 5; // Works
foo[0] = 1; // Works
writeln(foo[0]); // Works
writeln(foo[$ - 1]); // Error: undefined identifier __dollar
writeln(foo[0..2]); // Error: ArrayWrapper!(uint) cannot be sliced with
[]
}
--
More information about the Digitalmars-d-bugs
mailing list