Title
Defaulting and triviality
Status
c++11
Section
11.4.5 [class.ctor]
Submitter
FI

Created on 2010-08-03.00:00:00 last changed 102 months ago

Messages

Date: 2011-03-15.00:00:00

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

Date: 2011-03-15.00:00:00

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

Date: 2010-11-15.00:00:00

Proposed resolution (November, 2010):

This issue is resolved by the resolution of issue 1135.

Date: 2022-02-18.07:47:23
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.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: fdis -> c++11
2011-04-10 00:00:00adminsetmessages: + msg3361
2011-04-10 00:00:00adminsetstatus: ready -> fdis
2010-11-29 00:00:00adminsetmessages: + msg3058
2010-11-29 00:00:00adminsetstatus: extension -> ready
2010-08-23 00:00:00adminsetmessages: + msg2965
2010-08-03 00:00:00admincreate