diff options
| author | Marshall Clow <mclow.lists@gmail.com> | 2013-10-31 22:20:45 +0000 |
|---|---|---|
| committer | Marshall Clow <mclow.lists@gmail.com> | 2013-10-31 22:20:45 +0000 |
| commit | e1bedf4e939995fc190700f4a8a7fa12410c8577 (patch) | |
| tree | 8fb53c0442dd52489410c92bcb1f55471600d286 /libcxx/include/ostream | |
| parent | fc0447b8e49001e63ff5d24c97270be33d5ffcfb (diff) | |
| download | bcm5719-llvm-e1bedf4e939995fc190700f4a8a7fa12410c8577.tar.gz bcm5719-llvm-e1bedf4e939995fc190700f4a8a7fa12410c8577.zip | |
LWG issue 2341; Make the two variants of basic_ostream::seekp and basic_istream::seekg behave consistently; update tests to make sure
llvm-svn: 193814
Diffstat (limited to 'libcxx/include/ostream')
| -rw-r--r-- | libcxx/include/ostream | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libcxx/include/ostream b/libcxx/include/ostream index 2c618d41b9d..041314acc75 100644 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -1159,7 +1159,8 @@ inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(pos_type __pos) { - if (!this->fail()) + sentry __s(*this); + if (__s) { if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1)) this->setstate(ios_base::failbit); @@ -1172,8 +1173,12 @@ inline _LIBCPP_INLINE_VISIBILITY basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir) { - if (!this->fail()) - this->rdbuf()->pubseekoff(__off, __dir, ios_base::out); + sentry __s(*this); + if (__s) + { + if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1)) + this->setstate(ios_base::failbit); + } return *this; } |

