On Friday, 5 July 2013 at 03:12:44 UTC, Meta wrote:
I wasn't 100% sure the following is a bug, so I figured I'd ask.struct Fail { void opDispatch(string s)() { static assert(false, "Tried to call a method on Fail"); } } void main() { auto fail = Fail(); fail.s(); //Error: no property 's' for type 'Fail' }
Are you asking why the compiler doesn't halt at the static assert (and instead gives a 'no property' error)? (If you just want the code to compile and trigger a runtime assert due to the method call, remove the static from the assert line, and the dispatch will occur.)
