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 r12-10249] libstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600) Date: Mon, 18 Mar 2024 14:05:48 +0000 (GMT) [thread overview] Message-ID: <20240318140549.A2ECE385842A@sourceware.org> (raw) https://gcc.gnu.org/g:af1efe9ffeb4d21e2895081be1b88031166cdb93 commit r12-10249-gaf1efe9ffeb4d21e2895081be1b88031166cdb93 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Mar 22 11:10:38 2023 +0000 libstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600) As explained in LWG 3600, we never implemented a C++0x change that made the copy constructor of std::istream_iterator defined as defaulted. That would be an ABI break, so the resolution of LWG 3600 is to not require it to be trivial, but just constexpr and conditionally noexcept. This applies that resolution. libstdc++-v3/ChangeLog: * include/bits/stream_iterator.h (istream_iterator): Add constexpr to copy constructor, as per LWG 3600. * testsuite/24_iterators/istream_iterator/cons/constexpr.cc: Check copy construction. (cherry picked from commit ad0b9cf1a076fb9a802d9ba7fa2223aa3166dca2) Diff: --- libstdc++-v3/include/bits/stream_iterator.h | 1 + .../testsuite/24_iterators/istream_iterator/cons/constexpr.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h index 86c5845b835..019eaf840e7 100644 --- a/libstdc++-v3/include/bits/stream_iterator.h +++ b/libstdc++-v3/include/bits/stream_iterator.h @@ -77,6 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_stream(std::__addressof(__s)), _M_ok(true) { _M_read(); } + _GLIBCXX_CONSTEXPR istream_iterator(const istream_iterator& __obj) _GLIBCXX_NOEXCEPT_IF(is_nothrow_copy_constructible<_Tp>::value) : _M_stream(__obj._M_stream), _M_value(__obj._M_value), diff --git a/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc index 6b973c611a7..9570e7b9280 100644 --- a/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc +++ b/libstdc++-v3/testsuite/24_iterators/istream_iterator/cons/constexpr.cc @@ -24,5 +24,10 @@ int main() { __gnu_test::constexpr_default_constructible test; test.operator()<std::istream_iterator<char>>(); + + // LWG 3600. Making istream_iterator copy constructor trivial is an ABI break + __gnu_test::constexpr_single_value_constructible test2; + test2.operator()<std::istream_iterator<char>, std::istream_iterator<char>>(); + return 0; }
reply other threads:[~2024-03-18 14:05 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=20240318140549.A2ECE385842A@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).