Section: 220.127.116.11 [istream.iterator.cons] Status: C++17 Submitter: Erich Keane Opened: 2016-11-09 Last modified: 2017-07-30
Priority: Not Prioritized
View all other issues in [istream.iterator.cons].
View all issues with C++17 status.
Addresses GB 68, US 154, US 155The 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.
Change 18.104.22.168 [istream.iterator.cons] p1 as indicated:see below istream_iterator();
-1- Effects: Constructs the end-of-stream iterator. If
T is a literal type, then this constructor shall be aconstexpr constructor.
Change 22.214.171.124 [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 type, then this constructor shall bea trivial copy constructor.
Change 126.96.36.199 [istream.iterator.cons] p7 as indicated:~istream_iterator() = default;
-7- Effects: The iterator is destroyed. If
T is a literal type, then this destructor shall bea trivial destructor.
[Issues Telecon 16-Dec-2016]
Resolved by the adoption of P0503R0
Resolve by accepting the wording suggested by P0503R0.