opDispatch swallowing errors really sucks

Adam D. Ruppe destructionator at gmail.com
Fri Jan 10 14:58:47 UTC 2020


class A {
     void opDispatch(string s)() {
         static assert(0);
     }
}

void main() {
     A a = new A;
     a.test();
}

$ test.d(9): Error: no property test for type test.A


Did you typo it? Is it proxying a function call with wrong 
arguments? Who knows. Here's my proposal: if opDispatch is 
considered, its errors get printed. If you don't want that spam, 
use a template constraint to remove it from consideration 
entirely.


More information about the Digitalmars-d mailing list