diff options
author | Howard Hinnant <hhinnant@apple.com> | 2012-11-01 17:32:07 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2012-11-01 17:32:07 +0000 |
commit | 66e7ed959f9373f8596650e94b4176fe694be72a (patch) | |
tree | 6e4648508af61828efa7289f444c4e32ef21a518 | |
parent | 4eaf8ef5cbc1a41a4add1a72de7cc12f3df68f60 (diff) | |
download | bcm5719-llvm-66e7ed959f9373f8596650e94b4176fe694be72a.tar.gz bcm5719-llvm-66e7ed959f9373f8596650e94b4176fe694be72a.zip |
peek should set eofbit if sgetc() returns eof.
llvm-svn: 167238
-rw-r--r-- | libcxx/include/istream | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/include/istream b/libcxx/include/istream index 72b2004dd53..7b481864250 100644 --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -1189,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek() #endif // _LIBCPP_NO_EXCEPTIONS sentry __sen(*this, true); if (__sen) + { __r = this->rdbuf()->sgetc(); + if (traits_type::eq_int_type(__r, traits_type::eof())) + this->setstate(ios_base::eofbit); + } #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) |