public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39802]  New: std::num_get fails to pase negative zero input correctly
@ 2009-04-17 22:26 ritter at roguewave dot com
  2009-04-18  1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: ritter at roguewave dot com @ 2009-04-17 22:26 UTC (permalink / raw)
  To: gcc-bugs

A call to std::num_get fails to parse negative values (specifically -0 in my
example).

/** Begin Test **/
#include <cassert>
#include <locale>
#include <sstream>

int main ()
{
    unsigned long val = 1;

    std::stringbuf sb ("-0");
    std::istream is (&sb);

    std::ios_base::iostate err (std::ios_base::goodbit);

    typedef std::istreambuf_iterator<char> iter_t;

    const std::num_get<char, iter_t>& fac =
        std::use_facet<std::num_get <char> >(is.getloc ());

    fac.get (is, iter_t (), is, err, val);

    assert (is.eofbit == err && 0 == val);

    return 0;
}
/** End Test **/

Even thought this test case only exercises -0 I think the method should be able
to handle any negative value.  I have noted that other implementations do not
appear to exhibit this behavior.


-- 
           Summary: std::num_get fails to pase negative zero input correctly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ritter at roguewave dot com


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


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

end of thread, other threads:[~2009-04-21 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 22:26 [Bug libstdc++/39802] New: std::num_get fails to pase negative zero input correctly ritter at roguewave dot com
2009-04-18  1:17 ` [Bug libstdc++/39802] std::num_get fails to parse " paolo dot carlini at oracle dot com
2009-04-18 19:29 ` paolo at gcc dot gnu dot org
2009-04-18 19:31 ` paolo dot carlini at oracle dot com
2009-04-21 20:27 ` paolo at gcc dot gnu dot org
2009-04-21 20:27 ` 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).