__rvalue and Move Semantics first draft - aliasing problem/danger
Walter Bright
newshound2 at digitalmars.com
Tue Nov 19 06:50:51 UTC 2024
On 11/10/2024 9:36 AM, Timon Gehr wrote:
> I think the main potential trouble is that there is usually an assumption that
> there is no aliasing between rvalue arguments.
>
> For example, if a compiler backend assumes no aliasing, undefined behavior might
> be introduced if one of the arguments is modified and then the other is read.
>
> Of course, we can instead specify that the aliasing is legal (but it may still
> be surprising).
The problem exists anyway.
https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1021.md
This has been incorporated, but is only turned on with a switch.
More information about the dip.development
mailing list