public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/8348: fail() flag is set in istringstream when eof() flag is set !
@ 2002-10-25 2:06 adamwilkshire
0 siblings, 0 replies; only message in thread
From: adamwilkshire @ 2002-10-25 2:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 8348
>Category: c++
>Synopsis: fail() flag is set in istringstream when eof() flag is set !
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 25 02:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Adam Wilkshire
>Release: g++ 3.2
>Organization:
>Environment:
Solaris.
Reading specs from /opt/global/pkg/gcc-3.2/lib/gcc-lib/sparc-sun-solaris2.7/3.2/specs
Configured with: ../gcc-3.2/configure --prefix=/opt/global/pkg/ : (reconfigured) ../gcc-3.2/configure --prefix=/opt/global/pkg/gcc-3.2
Thread model: posix
gcc version 3.2
>Description:
fail() returns true when an operation on istringstream succeeds and reaches the end.
>How-To-Repeat:
run the program without arguments, tellg() fails because of the flag ...
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="temp8.cc"
Content-Disposition: inline; filename="temp8.cc"
#include <sstream>
#include <iostream>
#include <string>
int main(int argc,char** argv){
std::string num1("555");
std::istringstream iss(num1);
std::istream::pos_type pos1=iss.tellg();
int asNum=0;
iss >> asNum;
std::istream::pos_type pos2=iss.tellg();
std::streamoff off1=pos2-pos1;
std::cout<<"have "<<asNum<<":"<<off1<<std::endl;
std::cout<<iss.good()<<":"<<iss.bad()<<":"<<iss.fail()<<":"<<iss.eof()<<std::endl;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-25 9:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-25 2:06 c++/8348: fail() flag is set in istringstream when eof() flag is set ! adamwilkshire
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).