libstdc++: Fix std::from_chars to ignore leading zeros in base 2
authorJonathan Wakely <jwakely@redhat.com>
Wed, 24 Jun 2020 10:45:01 +0000 (11:45 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 24 Jun 2020 11:35:59 +0000 (12:35 +0100)
commiteb0ff770e29715deb8b2e6f5da736e0c1e8f8d07
tree9edf841f5567c4c6d06e117b009f5d2c4f1c148a
parent25920dd18ad12ea501309b1487366e22f35db631
libstdc++: Fix std::from_chars to ignore leading zeros in base 2

The parser for binary numbers returned an error if the entire string
contains more digits than the result type. Leading zeros should be
ignored.

libstdc++-v3/ChangeLog:

* include/std/charconv (__from_chars_binary): Ignore leading zeros.
* testsuite/20_util/from_chars/1.cc: Check "0x1" for all bases,
not just 10 and 16.
* testsuite/20_util/from_chars/3.cc: New test.
libstdc++-v3/include/std/charconv
libstdc++-v3/testsuite/20_util/from_chars/1.cc
libstdc++-v3/testsuite/20_util/from_chars/3.cc [new file with mode: 0644]