https://issues.dlang.org/show_bug.cgi?id=15582
--- Comment #3 from [email protected] --- (In reply to Marc Schütz from comment #2) > (In reply to b2.temp from comment #1) > > I don't aggree, it's like if you say that > > > > s.opSlice() = 10; > > > > should work. > > That should work, too. > > Note that appending another pair of brackets is already accepted. As long as > there's no ambiguity with assigning to the slice itself (i.e. the lhs is not > an lvalue, and opSlice doesn't return by ref), it should just do the > appropriate element-wise operation. > > Analogously with *=, += etc. Actually you overload the wrong operator, because this works: struct S { int[10] data; void opIndexAssign(int v) {data[] = v;} } void main() { S s; s[] = 10; } So I suggest you to close the issue. --
