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 via email to