public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/30561]  New: istream::operator>>(int&) broken
@ 2007-01-23 19:02 sebor at roguewave dot com
  2009-07-24 12:05 ` [Bug libstdc++/30561] [DR 696] " paolo dot carlini at oracle dot com
  2009-07-24 12:05 ` paolo dot carlini at oracle dot com
  0 siblings, 2 replies; 3+ messages in thread
From: sebor at roguewave dot com @ 2007-01-23 19:02 UTC (permalink / raw)
  To: gcc-bugs

Here's a test case for the problem I point out in c++std-lib-17897. It shows
that operator>>(int&) behaves differently (and, I claim, incorrectly) from
operator>>(long&) or any other extractor except the one for short (which is
affected for the same reason).

$ cat t.cpp && g++ t.cpp -static && ./a.out
#include <cassert>
#include <locale>
#include <sstream>

struct NumPunct: std::numpunct<char>
{
    std::string do_grouping () const { return "\3"; }
    char do_thousands_sep () const { return ';'; }
};

template <class T>
T extract (const char *s)
{
    std::istringstream strm (s);
    strm.imbue (std::locale (strm.getloc (), new NumPunct));

    T x = T ();
    strm >> x;
    assert ((strm.failbit | strm.eofbit) == strm.rdstate ());
    return x;
}

int main ()
{
    assert (123L == extract<long>("1;2;3"));
    assert (123  == extract<int>("1;2;3"));
}

Assertion failed: 123 == extract<int>("1;2;3"), file t.cpp, line 26
Abort (core dumped)


-- 
           Summary: istream::operator>>(int&) broken
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


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


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

* [Bug libstdc++/30561] [DR 696] istream::operator>>(int&) broken
  2007-01-23 19:02 [Bug libstdc++/30561] New: istream::operator>>(int&) broken sebor at roguewave dot com
  2009-07-24 12:05 ` [Bug libstdc++/30561] [DR 696] " paolo dot carlini at oracle dot com
@ 2009-07-24 12:05 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-24 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from paolo dot carlini at oracle dot com  2009-07-24 12:05 -------
The resolution of the DR is implemented in mainline.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-24 12:05:30
               date|                            |
            Summary|istream::operator>>(int&)   |[DR 696]
                   |broken                      |istream::operator>>(int&)
                   |                            |broken
   Target Milestone|---                         |4.5.0


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


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

* [Bug libstdc++/30561] [DR 696] istream::operator>>(int&) broken
  2007-01-23 19:02 [Bug libstdc++/30561] New: istream::operator>>(int&) broken sebor at roguewave dot com
@ 2009-07-24 12:05 ` paolo dot carlini at oracle dot com
  2009-07-24 12:05 ` paolo dot carlini at oracle dot com
  1 sibling, 0 replies; 3+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-24 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-07-24 12:05 -------
Fixed.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2009-07-24 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23 19:02 [Bug libstdc++/30561] New: istream::operator>>(int&) broken sebor at roguewave dot com
2009-07-24 12:05 ` [Bug libstdc++/30561] [DR 696] " paolo dot carlini at oracle dot com
2009-07-24 12:05 ` paolo dot carlini at oracle dot com

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