public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/15995] New: istringbuf/operator
@ 2004-06-15  7:23 debian-gcc at lists dot debian dot org
  2004-06-15  9:56 ` [Bug libstdc++/15995] istringbuf/operator pcarlini at suse dot de
  0 siblings, 1 reply; 2+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2004-06-15  7:23 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/254499 ]

g++-2.95.4 writes 01.

The following program prints 00 instead of the expected 01 (not sure, but it 
seems like a defect to me).  Once you call s >> i, all further str() updates 
are ignored by >>. 
 
#include <sstream> 
#include <iostream> 
 
main() { 
        std::istringstream s("0"); 
        int i; 
        s >> i; 
        std::cout << i; 
        s.str("1"); 
        s >> i; 
        std::cout << i; 
}

-- 
           Summary: istringbuf/operator
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15995


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/15995] istringbuf/operator
  2004-06-15  7:23 [Bug libstdc++/15995] New: istringbuf/operator debian-gcc at lists dot debian dot org
@ 2004-06-15  9:56 ` pcarlini at suse dot de
  0 siblings, 0 replies; 2+ messages in thread
From: pcarlini at suse dot de @ 2004-06-15  9:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-06-15 09:56 -------
Not a bug. At the end of the first call of operator>> the eofbit is set in s.
Then, at the beginning of the second operator>> the sentry finds eofbit set and
the whole input operation fails: i remains == 0. Just add s.clear(); in the
middle to get what you want.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15995


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-06-15  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-15  7:23 [Bug libstdc++/15995] New: istringbuf/operator debian-gcc at lists dot debian dot org
2004-06-15  9:56 ` [Bug libstdc++/15995] istringbuf/operator pcarlini at suse dot de

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).