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 r13-2869] libstdc++: Add #if around non-C++03 code in std::bitset [PR107037] Date: Mon, 26 Sep 2022 12:59:32 +0000 (GMT) [thread overview] Message-ID: <20220926125932.DE01B3858D32@sourceware.org> (raw) https://gcc.gnu.org/g:6904ed80a26f5216aa3b9ce8377fb50307c8e886 commit r13-2869-g6904ed80a26f5216aa3b9ce8377fb50307c8e886 Author: Jonathan Wakely <jwakely@redhat.com> Date: Mon Sep 26 11:11:35 2022 +0100 libstdc++: Add #if around non-C++03 code in std::bitset [PR107037] libstdc++-v3/ChangeLog: PR libstdc++/107037 * include/std/bitset (_Base_bitset::_M_do_reset): Use preprocessor conditional around non-C++03 code. * testsuite/20_util/bitset/107037.cc: New test. Diff: --- libstdc++-v3/include/std/bitset | 5 +++-- libstdc++-v3/testsuite/20_util/bitset/107037.cc | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 6dbc58c6429..1a551cf9785 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -182,13 +182,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX14_CONSTEXPR void _M_do_reset() _GLIBCXX_NOEXCEPT { +#if __cplusplus >= 201402L if (__builtin_is_constant_evaluated()) { for (_WordT& __w : _M_w) __w = 0; return; } - +#endif __builtin_memset(_M_w, 0, _Nw * sizeof(_WordT)); } @@ -1680,7 +1681,7 @@ _GLIBCXX_END_NAMESPACE_VERSION #endif // C++11 -#ifdef _GLIBCXX_DEBUG && _GLIBCXX_HOSTED +#if defined _GLIBCXX_DEBUG && _GLIBCXX_HOSTED # include <debug/bitset> #endif diff --git a/libstdc++-v3/testsuite/20_util/bitset/107037.cc b/libstdc++-v3/testsuite/20_util/bitset/107037.cc new file mode 100644 index 00000000000..b4560dd3775 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/bitset/107037.cc @@ -0,0 +1,7 @@ +// { dg-options "-std=c++03" } +// { dg-do compile } +// PR libstdc++/107037 bitset::_M_do_reset fails for strict -std=c++03 mode +#include <bitset> +template class std::bitset<0>; +template class std::bitset<1>; +template class std::bitset<100>;
reply other threads:[~2022-09-26 12:59 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=20220926125932.DE01B3858D32@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).