On Wednesday, 14 July 2021 at 12:49:58 UTC, Tejas wrote:
I think it's a bug, because the following works: ```d import std.stdio; struct abc{ int[100] a; int opIndex(int index){ return a[index]; } int opIndexUnary(string s)(int index) if(s == "++"){ return ++a[index]; } int[] opUnary(string s)() if (s == "++"){ return a[] += 1; } } void main (){ abc s; int[100] a; int temp; writeln (a[20]++); writeln(a[20]); writeln(++s[20]); writeln(s[20]); //writeln(s[0]++);// doesn't work for some reason writeln(s[0]); writeln(s++);//but this works!! writeln(s); } ```
```D writeln(++s[0]); // should work writeln(s++); // this calls opUnary if I'm not mistaken ```