gcc/libstdc++-v3/include
Jonathan Wakely 9b6c65c754 libstdc++: Fix exception handling in std::ostream seek functions
N3168 added the requirement that the [ostream.seeks] functions create a
sentry object. Nothing in the requirements of those functions says
anything about catching exceptions and setting badbit.

As well as not catching exceptions, this change results in another
observable behaviour change. Previously seeking on a stream with eofbit
set would work (as long as badbit and failbit weren't set). The
construction of a sentry causes failbit to be set when eofbit is set,
which causes the seek to fail. It is necessary to clear the eofbit
before seeking now.

libstdc++-v3/ChangeLog:

	* include/bits/ostream.tcc (sentry): Only set failbit if badbit
	is set, not if eofbit is set.
	(tellp, seekp, seekp): Create sentry object. Do not set badbit
	on exceptions.
	* testsuite/27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc:
	Adjust expected behaviour.
	* testsuite/27_io/basic_ostream/seekp/wchar_t/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/tellp/char/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/tellp/wchar_t/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/seekp/char/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/seekp/wchar_t/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/tellp/char/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/tellp/wchar_t/n3168.cc: New test.
2021-06-25 18:47:23 +01:00
..
backward
bits libstdc++: Fix exception handling in std::ostream seek functions 2021-06-25 18:47:23 +01:00
c
c_compatibility
c_global libstdc++: Add nodiscard attribute to cast-like functions 2021-04-06 16:43:25 +01:00
c_std
debug libstdc++: [_GLIBCXX_DEBUG] Enhance rendering of assert message 2021-05-26 21:50:17 +02:00
decimal libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
experimental libstdc++: Make use of __builtin_bit_cast for simd 2021-06-25 17:32:13 +02:00
ext libstdc++: Fix missing members in std::allocator<void> 2021-05-11 16:11:01 +01:00
parallel
precompiled
pstl libstdc++: Fix up parallel_backend_serial.h [PR97549] 2021-02-23 09:28:14 +01:00
std libstdc++: Remove noexcept from syncbuf::swap (LWG 3498) 2021-06-25 18:41:30 +01:00
tr1 libstdc++: Fix even more doxygen markup for group close commands 2021-04-09 13:09:23 +01:00
tr2 libstdc++: Fix doxygen markup for group close commands 2021-04-06 16:43:24 +01:00
Makefile.am libstdc++: Refactor/cleanup of C++20 atomic wait implementation 2021-04-20 15:14:58 +01:00
Makefile.in libstdc++: Refactor/cleanup of C++20 atomic wait implementation 2021-04-20 15:14:58 +01:00