Have basic_istream seekg, putback and unget first clear eofbit. Fixes http://llvm...
[lldb.git] / libcxx / include / istream
index 7b37e34..b48f856 100644 (file)
@@ -256,7 +256,7 @@ public:
 //    ~sentry() = default;
 
     _LIBCPP_INLINE_VISIBILITY
-    // explicit
+        _LIBCPP_EXPLICIT
         operator bool() const {return __ok_;}
 };
 
@@ -1145,7 +1145,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
                     }
                     ++__gc_;
                     char_type __ch = traits_type::to_char_type(__i);
-                    if (traits_type::eq(__ch, __dlm))
+                    if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
                         break;
                 }
             }
@@ -1161,7 +1161,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
                     }
                     ++__gc_;
                     char_type __ch = traits_type::to_char_type(__i);
-                    if (traits_type::eq(__ch, __dlm))
+                    if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
                         break;
                 }
             }
@@ -1212,7 +1212,6 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
         sentry __sen(*this, true);
         if (__sen)
         {
-            ios_base::iostate __err = ios_base::goodbit;
             for (; __gc_ < __n; ++__gc_)
             {
                 typename traits_type::int_type __i = this->rdbuf()->sbumpc();
@@ -1264,6 +1263,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
         sentry __sen(*this, true);
         if (__sen)
         {
@@ -1291,6 +1291,7 @@ basic_istream<_CharT, _Traits>::unget()
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
         sentry __sen(*this, true);
         if (__sen)
         {
@@ -1369,6 +1370,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
+        this->clear(this->rdstate() & ~ios_base::eofbit);
         sentry __sen(*this, true);
         if (__sen)
             if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))