+2002-05-03 Benjamin Kosnik <bkoz@redhat.com>
+
+ PR libstdc++/6549.
+ * include/bits/fstream.tcc (filebuf::_M_underflow_common): Revert.
+ * testsuite/27_io/narrow_stream_objects.cc (test07): Add.
+
2002-05-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* config/os/irix/irix5.2/bits/ctype_noninline.h (classic_table):
return traits_type::to_int_type(*_M_in_cur);
}
- // Check for unbuffered stream.
- if (_M_buf_size == 1)
- {
- int_type __c = _M_file.sys_getc();
- if (__c != __ret)
- {
- __ret = __c;
- *_M_in_cur = traits_type::to_char_type(__c);
- _M_set_determinate(1);
- if (__testout)
- _M_out_cur = _M_in_cur;
- }
- return __ret;
- }
-
// Sync internal and external buffers.
// NB: __testget -> __testput as _M_buf_unified here.
bool __testget = _M_in_cur && _M_in_beg < _M_in_cur;
__ret = traits_type::to_int_type(*_M_in_cur);
if (__bump)
_M_in_cur_move(1);
+ else if (_M_buf_size == 1)
+ {
+ // If we are synced with stdio, we have to unget the
+ // character we just read so that the file pointer
+ // doesn't move.
+ _M_file.sys_ungetc(*_M_in_cur);
+ _M_set_indeterminate();
+ }
}
}
}
cerr << "i == " << i << endl;
}
+// libstdc++/6548
+void test07()
+{
+ bool test = true;
+ std::cout << "Please, enter 'test':";
+ std::string s;
+ std::getline(std::cin, s, '\n');
+ VERIFY( s == "test" );
+}
+
int
main()
{
// test04();
// test05();
// test06();
+ // test07();
return 0;
}