[Issue 16627] [Reg 2.072] struct with disabled postblit field is now nested

2016-10-23 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16627

--- Comment #2 from Martin Nowak  ---
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.

--


[Issue 16627] [Reg 2.072] struct with disabled postblit field is now nested

2016-10-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16627

--- Comment #1 from Martin Nowak  ---
Caused by the 2nd commit of that PR
https://github.com/dlang/dmd/pull/5500/commits/75b5b691555bef2d2f21b44821f297f93ddfbc77.

--