[Issue 20808] [regression] opDispatch error disappears!

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 16 12:10:48 UTC 2022


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

--- Comment #5 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Adam D. Ruppe from comment #4)
> It modifies a const inside the opAssign which is why it fails. That's not
> supposed to be allowed so the error should happen.
> 
> All opDispatch does is forward directly to opIndexAssign, so if
> opIndexAssign doesn't compile, opDispatch shouldn't either.
> 
> You can call the assigned function by adding
> 
>     globals.printInt()(); //  be sure to use double parens thanks @property
> 
> if you take that const off the function definition, it works fine in either
> case showing the assignment was successful. But the const back on and you
> get error in the direct opIndexAssign and... silence on opDispatch.
> 
> You can even do
> 
>     globals.opDispatch!"printInt" = &printInt;
> 
> to get the error.

I'm trying to fix this issue, but I am not able to reproduce it.

globals["printInt"] = &printInt;

compiles just fine for me. Is this issue still actual? Also, a smaller test
case would help a lot in narrowing down the issue.

--


More information about the Digitalmars-d-bugs mailing list