[Issue 16627] [Reg 2.072] struct with disabled postblit field is now nested
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Oct 23 18:36:06 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16627
--- Comment #2 from Martin Nowak <code at dawg.eu> ---
This happens because structs are converted to nested structs by the semantic
analysis of their member functions.
The idea behind this seems to be that struct without methods can't access the
outer frame, hence never need nesting. Could be reconsidered to be deprecated
in favor of explicit `static struct` or a proper detection of closure access.
With dlang/dmd#5500 the dependency of the generate postblits/dtors on a
finalized struct size was removed, now semantic just collects a list of fields
and finalizes the size later on. This resolves some problems w/ forward
references.
Previously __fieldPostblit and __fieldDtor were generated after finalizing the
size and didn't convert structs to a nested one due to a `if (sizeok ==
SIZEOKdone) return;` check in makeNested. Now semantic for those functions runs
before the finalization and does convert structs to nested.
This bug only affects structs w/o any other function (b/c those would be nested
already) and at least one field w/ dtor/postblit.
--
More information about the Digitalmars-d-bugs
mailing list