Title
Non-trivial operations vs non-trivial initialization
Status
cd4
Section
6.7.3 [basic.life]
Submitter
Nico Josuttis

Created on 2013-09-15.00:00:00 last changed 94 months ago

Messages

Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-02-15.00:00:00

Proposed resolution (February, 2014):

Change 6.7.3 [basic.life] paragraph 1 as follows:

The lifetime of an object is a runtime property of the object. An object is said to have non-trivial initialization non-vacuous initialization if it is of a class or aggregate type and it or one of its members is initialized by a constructor other than a trivial default constructor. [Note: initialization by a trivial copy/move constructor is non-trivial non-vacuous initialization. —end note] The lifetime of an object of type T begins when:

  • storage with the proper alignment and size for type T is obtained, and

  • if the object has non-trivial non-vacuous initialization, its initialization is complete.

The lifetime of an object...

Date: 2013-09-15.00:00:00

The description of is_trivially_constructible in 21.3.5.4 [meta.unary.prop] paragraph 3 says,

is_constructible<T, Args...>::value is true and the variable definition for is_constructible, as defined below, is known to call no operation that is not trivial ( 6.8 [basic.types], 11.4.4 [special]).

This risks confusion when compared with the wording in 6.7.3 [basic.life] paragraph 1,

An object is said to have non-trivial initialization if it is of a class or aggregate type and it or one of its members is initialized by a constructor other than a trivial default constructor. [Note: initialization by a trivial copy/move constructor is non-trivial initialization. —end note]

The latter was written long before “trivial” became an important concept in its own right and uses the term differently from how it is used elsewhere in the Standard (as evidenced by the note referring to copy/move construction). The intent is to capture the idea that there is some actual initialization occurring; it should be rephrased to avoid the potential of confusion with the usage of “trivial” elsewhere.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5334
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-03-03 00:00:00adminsetmessages: + msg4803
2014-03-03 00:00:00adminsetstatus: open -> ready
2013-09-15 00:00:00admincreate