public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ritter at roguewave dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/39802]  New: std::num_get fails to pase negative zero input correctly
Date: Fri, 17 Apr 2009 22:26:00 -0000	[thread overview]
Message-ID: <bug-39802-17593@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-04-17 22:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-17 22:26 ritter at roguewave dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39802-17593@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).