[Issue 20808] [regression] opDispatch error disappears!

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 5 18:18:52 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20808

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
the reducted version is not good, dont take it to work on a fix. 

It's is perfectly normal that it is accepted:

---
struct var
{
        @property void opDispatch(string file, T)(T t)
        //if (is(T==char))
        {
                assert(t == 2);
        }
}

void main()
{
        var globals;
        globals.printInt = 2;                 // this and
        globals.opDispatch!("printInt") = 2;  // that are the same
}
---

Then when the constraint is enabled, it's perfectly normal that the code is
rejected, i.e per convertion rules.
Finally when `string file` is missing, this is also rejected as expected
because the template cant dispatch the "printInt" pseduo member.

--


More information about the Digitalmars-d-bugs mailing list