Title
tuple should be a literal type
Status
c++17
Section
[tuple.general]
Submitter
Jonathan Wakely

Created on 2016-11-09.00:00:00 last changed 89 months ago

Messages

Date: 2016-12-16.20:56:38

Proposed resolution:

This wording is relative to N4606.

  1. Add a new paragraph after [pairs.pair] p2:

    -2- The defaulted move and copy constructor, respectively, of pair shall be a constexpr function if and only if all required element-wise initializations for copy and move, respectively, would satisfy the requirements for a constexpr function. The destructor of pair shall be a trivial destructor if (is_trivially_destructible_v<T1> && is_trivially_destructible_v<T2>) is true.

  2. Add a new paragraph after the class synopsis in [tuple.tuple]:

    -?- The destructor of tuple shall be a trivial destructor if (is_trivially_destructible_v<Types> && ...) is true.

Date: 2017-02-02.00:41:18

[ Issues Telecon 16-Dec-2016 ]

Move to Review; we think this is right, but are awaiting implementation experience.

Date: 2016-11-15.00:00:00

[ 2016-11-09, Jonathan provides wording ]

Date: 2016-11-09.00:00:00

Addresses US 109

tuple should be a literal type if its elements are literal types; it fails because the destructor is not necessarily trivial. It should follow the form of optional and variant, and mandate a trivial destructor if all types in Types... have a trivial destructor. It is not clear if pair has the same issue, as pair specifies data members first and second, and appears to have an implicitly declared and defined destructor.

Suggested resolution:

Document the destructor for tuple, and mandate that it is trivial if each of the elements in the tuple has a trivial destructor. Consider whether the same specification is needed for pair.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2017-03-05 23:41:16adminsetstatus: review -> wp
2016-12-16 20:56:38adminsetmessages: + msg8726
2016-12-16 20:56:38adminsetstatus: new -> review
2016-11-09 22:18:13adminsetmessages: + msg8601
2016-11-09 22:18:13adminsetmessages: + msg8600
2016-11-09 00:00:00admincreate