gcc/libstdc++-v3/testsuite
Jonathan Wakely 638ad333ec Fix non-standard behaviour of std::istream_iterator
The current implementation of istream_iterator allows the iterator to be
reused after reaching end-of-stream, so that subsequent reads from the
stream can succeed (e.g. if the stream state has been cleared and stream
position changed from EOF). The P0738R2 paper clarified that the
expected behaviour is to set the stream pointer to null after reaching
end-of-stream, preventing further reads.

This implements that requirement, and adds the new default constructor
to std::ostream_iterator.

	* include/bits/stream_iterator.h (istream_iterator::_M_equal()): Make
	private.
	(istream_iterator::_M_read()): Do not check stream state before
	attempting extraction. Set stream pointer to null when extraction
	fails (P0738R2).
	(operator==(const istream_iterator&, const istream_iterator&)): Change
	to be a hidden friend of istream_iterator.
	(operator!=(const istream_iterator&, const istream_iterator&)):
	Likewise.
	(ostream_iterator::ostream_iterator()): Add default constructor.
	(ostream_iterator::ostream_iterator(ostream_type*, const C*)): Use
	addressof.
	* testsuite/24_iterators/istream_iterator/1.cc: New test.
	* testsuite/24_iterators/ostream_iterator/1.cc: New test.
	* testsuite/24_iterators/ostream_iterator/70766.cc: Also check
	constructor taking a string.
	* testsuite/24_iterators/ostream_iterator/requirements/constexpr.cc:
	New test.

From-SVN: r272491
2019-06-19 23:57:10 +01:00
..
17_intro
18_support Fix tests that fail with -std=gnu++98 or -std=gnu++11 2019-06-06 13:13:42 +01:00
19_diagnostics
20_util Fix AIX test failure due to replacement operator delete 2019-06-17 16:51:31 +01:00
21_strings Replace std::to_string for integers with optimized version 2019-06-12 15:52:02 +01:00
22_locale
23_containers Fix tests that fail without PCH 2019-06-17 09:18:17 +01:00
24_iterators Fix non-standard behaviour of std::istream_iterator 2019-06-19 23:57:10 +01:00
25_algorithms PR libstdc++/90920 restore previous checks for empty ranges 2019-06-19 23:57:02 +01:00
26_numerics Fix value category bugs in std::reduce 2019-06-19 16:29:49 +01:00
27_io PR libstdc++/90281 Fix string conversions for filesystem::path 2019-06-17 15:19:04 +01:00
28_regex
29_atomics
30_threads
abi
backward
config
data
decimal
experimental PR libstdc++/90281 Fix string conversions for filesystem::path 2019-06-17 15:19:04 +01:00
ext Fix tests that fail with -std=gnu++98 or -std=gnu++11 2019-06-06 13:13:42 +01:00
lib
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters Have std::vector printer's iterator return bool for vector<bool> 2019-06-19 23:57:06 +01:00
libstdc++-xmethods
performance
special_functions
tr1
tr2
util Implement new serial algorithms from Parallelism TS (P0024R2) 2019-06-19 00:01:16 +01:00
Makefile.am
Makefile.in