https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113260
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Since GCC 13 you can use _Float128 in older -std modes, and prior to GCC 13
there's no chance we're going to add this anyway.
The only thing missing here is that the _Float128 overloads are not declared
before C++23. They do exist in the library though, so if we declared them they
would be usable:
#include <charconv>
#if __cplusplus <= 202002L
namespace std
{
from_chars_result
from_chars(const char* __first, const char* __last, _Float128& __value,
chars_format __fmt = chars_format::general) noexcept;
to_chars_result
to_chars(char* __first, char* __last, _Float128 __value) noexcept;
}
#endif
int main()
{
char str[] = "0.5";
_Float128 d = 2.0;
std::to_chars(str, str+3, d);
std::from_chars(str, str+3, d);
}
We could also add inline overloads for __float128 that forward to the _Float128
functions. The difficulty would be detecting when that's safe to do. We only
define the _Float128 overloads when that type is supported, and every time we
touch the macros around this something breaks.
Confirming as an enhancement, but I don't intent to work on this myself.