From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 937673858C56; Tue, 9 Apr 2024 23:22:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 937673858C56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712704920; bh=80369038vMKSADsTO8c7Dlb0UaMcPnW+587NdDzEGYk=; h=From:To:Subject:Date:From; b=LNvUoLt9WOIwE9/I27t71y1nReopsOLHYtgBxXLjXx2bwk1qgawRBqe1SfF47oEYF 0jf70dZv0IbjVw+FITR4b8LcZEWu220wAWBsafHjMP1xGfW+U31g8sYuYr78PrB6Jo XPSmlTs4aBOtL5CkbPkcrZridqWX0asYchvt0lr8= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r14-9879] libstdc++: Fix build for targets without FP std::from_chars [PR114633] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 639215c5eb6c56ba3830cd868d1d3ddd700b4c90 X-Git-Newrev: 92b38ec84f2990d217f036dc6c5a32cde5ecfb93 Message-Id: <20240409232200.937673858C56@sourceware.org> Date: Tue, 9 Apr 2024 23:22:00 +0000 (GMT) List-Id: https://gcc.gnu.org/g:92b38ec84f2990d217f036dc6c5a32cde5ecfb93 commit r14-9879-g92b38ec84f2990d217f036dc6c5a32cde5ecfb93 Author: Jonathan Wakely Date: Mon Apr 8 17:37:32 2024 +0100 libstdc++: Fix build for targets without FP std::from_chars [PR114633] If the faster std::from_chars is not supported for floating-point types then just extract the value from the stream using operator>>. This fixes a build error for targets where __cpp_lib_to_chars is not defined. libstdc++-v3/ChangeLog: PR libstdc++/114633 * include/bits/chrono_io.h (_Parser::operator()) <'S'>: Use stream extraction if std::from_chars is not available. Diff: --- libstdc++-v3/include/bits/chrono_io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index b9eb3d2be53..3b34992b42a 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -3685,6 +3685,7 @@ namespace __detail if (!__is_failed(__err)) [[likely]] { long double __val{}; +#if __cpp_lib_to_chars string __str = std::move(__buf).str(); auto __first = __str.data(); auto __last = __first + __str.size(); @@ -3694,6 +3695,9 @@ namespace __detail if ((bool)ec || ptr != __last) [[unlikely]] __err |= ios_base::failbit; else +#else + if (__buf >> __val) +#endif { duration __fs(__val); if constexpr (__is_floating)