On 05/19/2017 01:07 PM, Jason Merrill wrote:
On Tue, May 16, 2017 at 5:39 PM, Martin Sebor <mse...@gmail.com> wrote:
On 05/16/2017 01:41 PM, Jason Merrill wrote:
I'm still not convinced we need to consider standard-layout at all.
I agree. The patch doesn't make use of is_standard_layout_p().
It defines its own helper called almost_std_layout_p() that
combines trivial_type_p() with tests for non-public members,
That's the part that seems unnecessary. Why do we care about
non-public members?
Because modifying them breaks encapsulation.
If I take a legacy struct, make some of its members private,
and define accessors and modifiers to manipulate those members
and maintain invariants between them, I will want to check and
adjust all code that changes objects of the struct in ways that
might violate the invariants.
What common use case are you concerned about that isn't more
appropriately expressed using the generated default or copy
constructor or assignment operator?
Martin