[Issue 7733] New: [tdpl] opIndexUnary not called with postfix increment/decrement operators
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Mar 19 10:56:23 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7733
Summary: [tdpl] opIndexUnary not called with postfix
increment/decrement operators
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: hsteoh at quickfur.ath.cx
--- Comment #0 from hsteoh at quickfur.ath.cx 2012-03-19 10:56:39 PDT ---
struct S {
int[] data;
void opIndex(size_t i) { return data[i]; }
void opIndexUnary(string op)(size_t i) {
return mixin(op ~ "data[i]");
}
}
void main() {
S s;
s.data = [1,2,3];
++s[0]; // OK
s[0]++; // Error: s.opIndex(1u) is not an lvalue
}
This contradicts the specs, that specify that x++ is translated to ++x, which
should cause opIndexUnary!"++" to be called, not opIndex.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list