Uncallable delegates
Timon Gehr
timon.gehr at gmx.ch
Sat May 16 06:13:37 UTC 2026
On 5/16/26 03:45, Walter Bright wrote:
> I've already acknowledged and filed a bug report with `pure` on delegates:
>
> https://github.com/dlang/dmd/issues/23125
> ...
This is a completely unrelated issue. Not every code that has a
soundness issue and also contains the `pure` keyword is the same problem.
> If the `pure` is necessary for your example issue, then that is the
> problem.
No, that's just a part in the exploit chain that allows me to modify
`immutable` data, because that is what you asked for.
> If it is not necessary, why is it there?
> ...
To allow converting the result to `immutable`.
The most obvious fix is to disallow calling a `immutable(T
delegate(S))`, just like `const(T delegate(S))` must not be callable.
We should at the very least be able to agree on this, because this is
how it works for classes.
More information about the dip.development
mailing list