This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1145. Defaulting and triviality

Section: 11.4.5  [class.ctor]     Status: C++11     Submitter: FI     Date: 2010-08-03

[Voted into the WP at the March, 2011 meeting.]

N3092 comment FI 4

What effect does defaulting have on triviality? Related to issue 1135, non-public special members defaulted on their first declaration should retain triviality, because they shouldn't be considered user-provided. Related to issue 1137, defaulted member functions that are virtual should not be considered trivial, but there's no reason why non-virtuals could not be.

Furthermore, a class with a non-public explicitly-defaulted constructor isn't ever trivially constructible under the current rules. If such a class is used as a subobject, the constructor of the aggregating class should be trivial if it can access the non-public explicitly defaulted constructor of a subobject.

Suggested resolution: Change the triviality rules so that a class can have a trivial default constructor if the class has access to the default constructors of its subobjects and the default constructors of the subobjects are explicitly defaulted on first declaration, even if said defaulted constructors are non-public.

See also issue 1149.

Rationale (August, 2010):

The consensus of the CWG was that this change should not be made at this point in the standardization process, but that it might be considered at a later date.

Proposed resolution (November, 2010):

This issue is resolved by the resolution of issue 1135.