April 19, 2014 [Issue 12599] New: templated inout opIndex gives strange error | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: temtaime@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. -- |
Copyright © 1999-2021 by the D Language Foundation