I tried defining opAdd for S as following: auto opAdd(alias rhs)() if (is(typeof(rhs) == S)) { return Test!(n + rhs.n); }
Which I know is kind of silly, since I can't use opAdd to do a + b anymore, but it fails to compile anyway. The compiler says that b (of type Test) does not match a's version of opAdd, which doesn't seem right to me.
Removing the template constraint doesn't help either, as I run into "local variable argument to non-global template" bug, and I can't get the structs to be evaluated at compile time, so I guess that's a lost cause.