public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-9895] libstdc++: Fix constexpr functions to conform to older standards Date: Wed, 27 Sep 2023 21:10:27 +0000 (GMT) [thread overview] Message-ID: <20230927211027.0FE5B385828D@sourceware.org> (raw) 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) {
reply other threads:[~2023-09-27 21:10 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230927211027.0FE5B385828D@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).