Title
Awkward conflation of trivial special members of istream_iterator
Status
c++17
Section
[istream.iterator.cons]
Submitter
Erich Keane

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

Messages

Date: 2016-12-16.20:56:38

Proposed resolution:

Resolve by accepting the wording suggested by P0503R0.

Date: 2017-02-02.00:41:18

[ Issues Telecon 16-Dec-2016 ]

Resolved by the adoption of P0503R0

Date: 2016-11-09.22:03:49

Addresses GB 68, US 154, US 155

The term 'literal type' is dangerous and misleading, as text using this term really wants to require that a constexpr constructor/initialization is called with a constant expression, but does not actually tie the selected constructor to the type being 'literal'.

Suggested resolution:

Verify the uses of the term in the Core and Library specifications and replace with something more precise where appropriate.

The conflation of trivial copy constructor and literal type is awkward. Not all literal types have trivial copy constructors, and not all types with trivial copy constructors are literal.

Suggested resolution:

Revise p5 as:

Effects: Constructs a copy of x. If T has a trivial copy constructor, then this constructor shall be a trivial copy constructor. If T has a constexpr copy constructor, then this constructor shall be constexpr.

The requirement that the destructor is trivial if T is a literal type should be generalized to any type T with a trivial destructor — this encompasses all literal types, as they are required to have a trivial destructor.

Suggested resolution:

Revise p7 as:

Effects: The iterator is destroyed. If T has a trivial destructor, then this destructor shall be a trivial destructor.

Previous resolution [SUPERSEDED]:

This wording is relative to N4606.

  1. Change [istream.iterator.cons] p1 as indicated:

    see below istream_iterator();
    

    -1- Effects: Constructs the end-of-stream iterator. If T is a literal typeis_trivially_constructible_v<T> == true, then this constructor shall be ais a trivial, constexpr constructor.

  2. Change [istream.iterator.cons] p5 as indicated:

    istream_iterator(const istream_iterator& x) = default;
    

    -5- Effects: Constructs a copy of x. If T is a literal typeis_trivially_copyable_v<T> == true, then this constructor shall beis a trivial copy constructor.

  3. Change [istream.iterator.cons] p7 as indicated:

    ~istream_iterator() = default;
    

    -7- Effects: The iterator is destroyed. If T is a literal typeis_trivially_destructible_v<T> == true, then this destructor shall beis a trivial destructor.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-12-16 20:56:38adminsetmessages: + msg8724
2016-12-16 20:56:38adminsetstatus: new -> wp
2016-11-09 21:00:30adminsetmessages: + msg8593
2016-11-09 00:00:00admincreate