AA and struct with const member

frame frame86 at live.com
Wed Dec 29 02:33:08 UTC 2021

On Wednesday, 29 December 2021 at 01:11:13 UTC, Stanislav Blinov 

> Because opIndexAssign cannot distinguish at compile time 
> between initialization and assignment:
> ```d
> Stuff[Key] aa;
> aa[key] = Stuff(args); // ostensibly, initialization
> aa[key] = otherStuff;  // assignment to existing value
> ```
> Same syntax, different behavior. This can only be caught at 
> runtime. `require` and `update` though should be able to pull 
> this off, and that they don't is a bug.

Of course but opIndexAssign() isn't there in my example. The 
compiler should call runtime's _aaGetY() or something like that 

More information about the Digitalmars-d-learn mailing list