]> git.ipfire.org Git - thirdparty/gcc.git/commit
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 14:26:45 +0000 (15:26 +0100)
commit053ba9ec74722c938aa37699f458c0d748333315
treef2893c7606ccc50423c5224664bf32060eea5898
parent50615814f6ffc6f5be0017bc6392939226d0d650
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.

(cherry picked from commit eb0ff770e29715deb8b2e6f5da736e0c1e8f8d07)
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]