[PATCH] C++17 P0067R5 std::to_chars and std::from_chars (partial)

Jonathan Wakely jwakely@redhat.com
Thu Oct 5 20:27:00 GMT 2017


On 05/10/17 22:00 +0200, Christophe Lyon wrote:
>Hi Jonathan,
>
>On 3 October 2017 at 16:31, Jonathan Wakely <jwakely@redhat.com> wrote:
>> On 02/10/17 15:13 +0100, Jonathan Wakely wrote:
>>>
>>> +#ifndef _GLIBCXX_CHARCONV
>>> +#define _GLIBCXX_CHARCONV 1
>>> +
>>> +#pragma GCC system_header
>>> +
>>> +#if __cplusplus >= 201402L
>>> +
>>> +#include <type_traits>
>>> +#include <limits>
>>> +#include <cctype>
>>> +#include <bits/error_constants.h> // for std::errc
>>
>>
>> I forgot to mention that I've made this header work for C++14 not just
>> C++17. I
>> did this for similar reasons as we make some C++17 things available for
>> -std=gnu++11 and -std=gnu++14:
>>
>> #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
>>
>> But in this case <charconv> is a completely new header so we don't have to
>> limit it to -std=gnu++NN modes only. The new functions won't pollute
>> namespace
>> std unless the new header gets included, which strictly-conforming C++14
>> code
>> won't do anyway.
>>
>
>Sorry for the delay, I'm still catching up after Linaro Connect.
>
>I've noticed that one of the new tests (20_util/to_chars/1.cc)
>fails to compile on ARM and AArch64 bare-metal targets (with Newlib).
>That is, arm-none-eabi and aarch64-none-elf targets.
>
>The error message I'm seeing is:
>/libstdc++-v3/testsuite/20_util/to_chars/1.cc: In function 'void test01()':
>/libstdc++-v3/testsuite/20_util/to_chars/1.cc:88: error:
>'std::to_string' has not been declared
>In file included from /libstdc++-v3/testsuite/20_util/to_chars/1.cc:38:
>/libstdc++-v3/testsuite/20_util/to_chars/1.cc:90: error: 'to_string'
>was not declared in this scope
>/libstdc++-v3/testsuite/util/testsuite_hooks.h:57: note: in definition
>of macro 'VERIFY'

Should be fixed with the attached patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 690 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20171005/3ab42446/attachment.bin>


More information about the Libstdc++ mailing list