https://issues.dlang.org/show_bug.cgi?id=14935
--- Comment #7 from ag0ae...@gmail.com --- (In reply to Ryuichi OHORI from comment #6) > I agree with you on closing this as invalid. The main problem was that I > missed opIndexOpAssign and tried to use opIndex/opSlice (of a struct S) + > opOpAssign (of the returning Voldemort type of S.opIndex). > > While I went wrong, the error message "cannot be sliced with []" is not so > helpful as to help me figuring out the problem. If I understand correctly, you're describing something like this: ---- struct V { void opOpAssign(string op)(int x) {} } struct S { V opIndex() {return V();} } void main() { S s; s[] += 2; /* Error: S cannot be sliced with [] */ } ---- That error message really doesn't help. And it actually works when you use a temporary variable to hold the result of s[]: ---- S s; auto v = s[]; v += 2; /* no error */ ---- So I'd say that's a rejects-valid bug. I filed issue 14941 for that. > One of the reasons I missed opIndexOpAssign was that it is categorized under > Op Assignment Operator Overloading. I'd like to place it under Array > Indexing and Slicing Operators Overloading. I don't know where it fits best. Maybe just make a pull request and see how it goes. --