[Issue 24838] A closure with a layout of pointer size or below that is not modified, should not have a closure

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 11 03:25:05 UTC 2024


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

--- Comment #11 from Manu <turkeyman at gmail.com> ---
This is a language thing; GDC/LDC have nothing to say about this.
The frontend implements this, it's semantic to detect if a closure only
contains a single thing and then delete it.

Yes, you touched on one issue with mutability of references to stack objects;
however `this` is not mutable, it's impossible for `this` to change during the
lifetime of the closure, which is why my initial request applies to `this`...
any expansion of this optimisation is theoretical, but the case for `this`,
which is overwhelmingly the most common and the most useful case should be
addressed initially.

Also, why did you rename my issue? :/

--


More information about the Digitalmars-d-bugs mailing list