[Issue 12599] New: templated inout opIndex gives strange error
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Apr 19 13:09:38 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12599
Issue ID: 12599
Summary: templated inout opIndex gives strange error
Product: D
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: temtaime at gmail.com
struct S(T) {
T[1] a;
pure ref T opIndex(size_t i) inout { return a[i]; }
}
void main() {
S!short s;
}
/d952/f855.d(4): Error: cast(short)this.a[i] is not an lvalue /d952/f855.d(8):
Error: template instance f855.S!short error instantiating
If in prototype T is ommited like this
pure ref opIndex(size_t i) inout { return a[i]; }
It compiles ok.
--
More information about the Digitalmars-d-bugs
mailing list