public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/103904] [defect fix] Please backport P2325R3 to 10 and 11
Date: Fri, 11 Feb 2022 14:04:04 +0000	[thread overview]
Message-ID: <bug-103904-4-sH8izB42bW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103904-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103904

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:92d612cccc1eeccf858cecd29ce4b7e734df7ae9

commit r11-9555-g92d612cccc1eeccf858cecd29ce4b7e734df7ae9
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri Feb 11 09:01:51 2022 -0500

    libstdc++: Implement P2325 changes to default-constructibility of views

    NB: This backport of r12-1606 to the 11 branch deliberately omits parts
    of P2325R3 so as to maximize backward compatibility with pre-P2325R3 code.
    In particular, we don't remove the default ctors for back_insert_iterator,
    front_insert_iterator, ostream_iterator, ref_view and basic_istream_view.

    ===

    This implements the wording changes of P2325R3 "Views should not be
    required to be default constructible".  Changes are relatively
    straightforward, besides perhaps those to __box (which now stands
    for copyable-box instead of semiregular-box) and __non_propagating_cache.

    For __box, this patch implements the recommended practice to also avoid
    std::optional when the boxed type is nothrow_move/copy_constructible.

    For __non_propagating_cache, now that it's used by split_view::_M_current,
    we need to add assignment from a value of the underlying type to the
    subset of the std::optional API implemented for the cache (needed by
    split_view::begin()).  Hence the new __non_propagating_cache::operator=
    overload.

    In passing, this fixes the undesirable list-init in the constructors of
    the partial specialization of __box as reported in PR100475 comment #7.

            PR libstdc++/103904

    libstdc++-v3/ChangeLog:

            * include/bits/iterator_concepts.h (weakly_incrementable): Remove
            default_initializable requirement.
            * include/bits/ranges_base.h (ranges::view): Likewise.
            * include/bits/ranges_util.h (subrange): Constrain the default
            ctor.
            * include/bits/stl_iterator.h (common_iterator): Constrain the
            default ctor.
            (counted_iterator): Likewise.
            * include/std/ranges (__detail::__box::operator=): Handle
            self-assignment in the primary template.
            (__detail::__box): In the partial specialization: adjust
            constraints as per P2325.  Add specialized operator= for the
            case when the wrapped type is not copyable.  Constrain the
            default ctor.  Avoid list-initialization.
            (single_view): Constraint the default ctor.
            (iota_view): Relax semiregular constraint to copyable.
            Constrain the default ctor.
            (iota_view::_Iterator): Constraint the default ctor.
            (ref_view): Remove the default ctor.  Remove NSDMIs.
            (ref_view::_Iterator): Constrain the default ctor.
            (__detail::__non_propagating_cache::operator=): Define overload
            for assigning from a value of the underlying type.
            (filter_view): Likewise.
            (filter_view::_Iterator): Likewise.
            (transform_view): Likewise.
            (transform_view::_Iterator): Likewise.
            (take_view): Likewise.
            (take_view::_Iterator): Likewise.
            (take_while_view): Likewise.
            (take_while_view::_Iterator): Likewise.
            (drop_while_view): Likewise.
            (drop_while_view::_Iterator): Likewise.
            (join_view): Likewise.
            (split_view::_OuterIter::__current): Adjust after changing the
            type of _M_current.
            (split_view::_M_current): Wrap it in a __non_propagating_cache.
            (split_view::split_view): Constrain the default ctor.
            (common_view): Constrain the default ctor.
            (reverse_view): Likewise.
            (elements_view): Likewise.
            * include/std/span (enable_view<span<_ElementType, _Extent>>):
            Define this partial specialization to true unconditionally.
            * include/std/version (__cpp_lib_ranges): Adjust value.
            * testsuite/std/ranges/adaptors/detail/semiregular_box.cc:
            Rename to ...
            * testsuite/std/ranges/adaptors/detail/copyable_box.cc: ... this.
            (test02): Adjust now that __box is copyable-box not
            semiregular-box.
            (test03): New test.
            * testsuite/std/ranges/p2325.cc: New test.
            * testsuite/std/ranges/single_view.cc (test06): New test.
            * testsuite/std/ranges/view.cc: Adjust now that view doesn't
            require default_initializable.

    (cherry picked from commit 4b4f5666b4c2f3aab2a9f3d53d394e390b9b682d)

  parent reply	other threads:[~2022-02-11 14:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 15:22 [Bug c++/103904] New: " h2+bugs at fsfe dot org
2022-01-04 15:45 ` [Bug libstdc++/103904] " redi at gcc dot gnu.org
2022-01-04 15:46 ` redi at gcc dot gnu.org
2022-01-04 15:51 ` redi at gcc dot gnu.org
2022-01-04 15:55 ` h2+bugs at fsfe dot org
2022-01-04 16:13 ` redi at gcc dot gnu.org
2022-01-04 17:13 ` h2+bugs at fsfe dot org
2022-01-05  8:42 ` rguenth at gcc dot gnu.org
2022-02-08 15:53 ` h2+bugs at fsfe dot org
2022-02-08 16:30 ` redi at gcc dot gnu.org
2022-02-08 16:54 ` redi at gcc dot gnu.org
2022-02-08 20:58 ` h2+bugs at fsfe dot org
2022-02-11 14:04 ` cvs-commit at gcc dot gnu.org [this message]
2022-02-11 14:04 ` cvs-commit at gcc dot gnu.org
2022-02-11 14:04 ` cvs-commit at gcc dot gnu.org
2022-02-11 20:40 ` cvs-commit at gcc dot gnu.org
2022-05-31 18:39 ` cvs-commit at gcc dot gnu.org
2022-05-31 18:39 ` cvs-commit at gcc dot gnu.org
2022-05-31 18:49 ` ppalka at gcc dot gnu.org
2022-05-31 19:50 ` h2+bugs at fsfe dot org

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=bug-103904-4-sH8izB42bW@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).