public inbox for libstdc++-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 r14-6942] libstdc++: Use if-constexpr in std::__try_use_facet [PR113099] Date: Fri, 5 Jan 2024 10:23:47 +0000 (GMT) [thread overview] Message-ID: <20240105102347.B704C3858D32@sourceware.org> (raw) https://gcc.gnu.org/g:9f3eb93e72703f6ea30aa27d0b6fc6db62cb4a04 commit r14-6942-g9f3eb93e72703f6ea30aa27d0b6fc6db62cb4a04 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Jan 3 12:23:32 2024 +0000 libstdc++: Use if-constexpr in std::__try_use_facet [PR113099] As noted in the PR, we can use if-constexpr for the explicit instantantiation definitions that are compiled with -std=gnu++11. We just need to disable the -Wc++17-extensions diagnostics. libstdc++-v3/ChangeLog: PR libstdc++/113099 * include/bits/locale_classes.tcc (__try_use_facet): Use if-constexpr for C++11 and up. Diff: --- libstdc++-v3/include/bits/locale_classes.tcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/locale_classes.tcc b/libstdc++-v3/include/bits/locale_classes.tcc index 2a6176fb4de..63097582dec 100644 --- a/libstdc++-v3/include/bits/locale_classes.tcc +++ b/libstdc++-v3/include/bits/locale_classes.tcc @@ -87,6 +87,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __s2.data(), __s2.data() + __s2.length()) < 0); } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wc++17-extensions" template<typename _Facet> inline const _Facet* __try_use_facet(const locale& __loc) _GLIBCXX_NOTHROW @@ -97,7 +99,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // We know these standard facets are always installed in every locale // so dynamic_cast always succeeds, just use static_cast instead. #define _GLIBCXX_STD_FACET(...) \ - if _GLIBCXX17_CONSTEXPR (__is_same(_Facet, __VA_ARGS__)) \ + if _GLIBCXX_CONSTEXPR (__is_same(_Facet, __VA_ARGS__)) \ return static_cast<const _Facet*>(__facets[__i]) _GLIBCXX_STD_FACET(ctype<char>); @@ -145,6 +147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return static_cast<const _Facet*>(__facets[__i]); #endif } +#pragma GCC diagnostic pop /** * @brief Test for the presence of a facet.
reply other threads:[~2024-01-05 10:23 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=20240105102347.B704C3858D32@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).