public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9895] libstdc++: Fix constexpr functions to conform to older standards
@ 2023-09-27 21:10 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-09-27 21:10 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:374f41517ab2fd78dafe3a0a1874bb9738966e74
commit r12-9895-g374f41517ab2fd78dafe3a0a1874bb9738966e74
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Aug 9 11:11:31 2023 +0100
libstdc++: Fix constexpr functions to conform to older standards
Some constexpr functions were inadvertently relying on relaxed constexpr
rules from later standards.
libstdc++-v3/ChangeLog:
* include/experimental/bits/fs_path.h (path::string): Use
_GLIBCXX17_CONSTEXPR not _GLIBCXX_CONSTEXPR for 'if constexpr'.
* include/std/charconv (__to_chars_8): Initialize variable for
C++17 constexpr rules.
(cherry picked from commit b3a2b307b9deea719fb725a86df43b82176fe459)
Diff:
---
libstdc++-v3/include/experimental/bits/fs_path.h | 2 +-
libstdc++-v3/include/std/charconv | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index ba6acb2158d..c13195a6ba9 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -1049,7 +1049,7 @@ namespace __detail
inline std::basic_string<_CharT, _Traits, _Allocator>
path::string(const _Allocator& __a) const
{
- if _GLIBCXX_CONSTEXPR (is_same<_CharT, value_type>::value)
+ if _GLIBCXX17_CONSTEXPR (is_same<_CharT, value_type>::value)
return { _M_pathname.begin(), _M_pathname.end(), __a };
using _WString = basic_string<_CharT, _Traits, _Allocator>;
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index 533320ea085..b4d37435fa0 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -236,7 +236,7 @@ namespace __detail
static_assert(is_unsigned<_Tp>::value, "implementation bug");
to_chars_result __res;
- unsigned __len;
+ unsigned __len = 0;
if _GLIBCXX17_CONSTEXPR (__gnu_cxx::__int_traits<_Tp>::__digits <= 16)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-09-27 21:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-27 21:10 [gcc r12-9895] libstdc++: Fix constexpr functions to conform to older standards Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).