opDispatch swallowing errors really sucks

Ernesto Castellotti erny.castell at gmail.com
Sun Jan 12 18:32:06 UTC 2020


On Friday, 10 January 2020 at 14:58:47 UTC, Adam D. Ruppe wrote:
> 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.

I think it happens because of issue 
https://issues.dlang.org/show_bug.cgi?id=14145


More information about the Digitalmars-d mailing list