]> 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 15:06:30 +0000 (16:06 +0100)
commitce2da7f82f4f5469c435ff3731fdeaffcdab0f66
treeba63cf31c39bf14db6f161149625a12a7f2a72ad
parentea3f1f2347841c7bbc469c0a7c8fd46fdbb0b251
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]