public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Tamar Christina <tnfchris@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-struct-reorg-wip)] libstdc++: Add missing friend declaration to join_view::_Sentinel Date: Fri, 17 Jul 2020 13:29:25 +0000 (GMT) [thread overview] Message-ID: <20200717132925.83E3739FE80A@sourceware.org> (raw) https://gcc.gnu.org/g:6aa2ca21a442a775b7daf214b8c10fce8522ccda commit 6aa2ca21a442a775b7daf214b8c10fce8522ccda Author: Patrick Palka <ppalka@redhat.com> Date: Thu Mar 5 11:19:17 2020 -0500 libstdc++: Add missing friend declaration to join_view::_Sentinel The converting constructor of join_view::_Sentinel<true> needs to be able to access the private members of join_view::_Sentinel<false>. libstdc++-v3/ChangeLog: * include/std/ranges (join_view::_Sentinel<_Const>): Befriend join_view::_Sentinel<!_Const>. * testsuite/std/ranges/adaptors/join.cc: Augment test. Diff: --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/std/ranges | 2 ++ libstdc++-v3/testsuite/std/ranges/adaptors/join.cc | 23 ++++++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index b2e995b4daf..b3e8b9a25d2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2020-03-06 Patrick Palka <ppalka@redhat.com> + * include/std/ranges (join_view::_Sentinel<_Const>): Befriend + join_view::_Sentinel<!_Const>. + * testsuite/std/ranges/adaptors/join.cc: Augment test. + PR libstdc++/93978 * include/bits/range_access.h (__cust_access::_Empty::operator()): Declare return type to be bool instead of auto. diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index c71cf918cfc..eb54b110c04 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -2592,6 +2592,8 @@ namespace views friend constexpr bool operator==(const _Iterator<_Const>& __x, const _Sentinel& __y) { return __y.__equal(__x); } + + friend _Sentinel<!_Const>; }; _Vp _M_base = _Vp(); diff --git a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc index d3e652da009..142c9feddcd 100644 --- a/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc +++ b/libstdc++-v3/testsuite/std/ranges/adaptors/join.cc @@ -101,6 +101,28 @@ test05() VERIFY( i == v.end() ); } +void +test06() +{ + std::vector<std::string> x = {""}; + auto i = std::counted_iterator(x.begin(), 1); + auto r = ranges::subrange{i, std::default_sentinel}; + auto v = r | views::transform(std::identity{}) | views::join; + + // Verify that _Iterator<false> is implicitly convertible to _Iterator<true>. + static_assert(!std::same_as<decltype(ranges::begin(v)), + decltype(ranges::cbegin(v))>); + auto a = ranges::cbegin(v); + a = ranges::begin(v); + + // Verify that _Sentinel<false> is implicitly convertible to _Sentinel<true>. + static_assert(!ranges::common_range<decltype(v)>); + static_assert(!std::same_as<decltype(ranges::end(v)), + decltype(ranges::cend(v))>); + auto b = ranges::cend(v); + b = ranges::end(v); +} + int main() { @@ -109,4 +131,5 @@ main() test03(); test04(); test05(); + test06(); }
reply other threads:[~2020-07-17 13:29 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=20200717132925.83E3739FE80A@sourceware.org \ --to=tnfchris@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).