[Bug c++/59568] New: complex type operator>> does not set eofbit for input streams.
Physeterm at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 20 21:57:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59568
Bug ID: 59568
Summary: complex type operator>> does not set eofbit for input
streams.
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Physeterm at yahoo dot com
Created attachment 31489
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31489&action=edit
g++ -v
(Actually, it is set, it's just cleared before the return to caller)
The problem as I understand it is that the call to __is.putback(__ch)
resets the eofbit to 0, (in C++11) after a valid eof has been detected.
The next extraction operation fails on attempting to get a char type
but the eofbit is not set to 1.
This precludes the ability to do error checking on input files.
A simple solution I think would be to test for the eofbit before
attempting the putback. ie:
else
{
if (! __is.eof()) {
__is.putback(__ch);
__is >> __re_x;
__x = __re_x;
}
}
return __is;
}
in file /usr/include/c++/4.8.1/complex (This only fixes int types)
More information about the Gcc-bugs
mailing list