Bug 12599 – templated inout opIndex gives strange error

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-19T20:09:00Z
Last change time
2015-06-09T05:14:59Z
Keywords
rejects-valid
Assigned to
nobody
Creator
temtaime

Comments

Comment #0 by temtaime — 2014-04-19T20:09:38Z
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.
Comment #1 by temtaime — 2014-04-19T20:19:34Z
Oups sorry it's my mistake and it's not a bug.