public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Patrick Palka <ppalka@redhat.com>
Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org
Subject: Re: [PATCH] libstdc++: Simplify range adaptors' forwarding of bound args when possible
Date: Thu, 3 Jun 2021 13:10:54 +0100	[thread overview]
Message-ID: <YLjGznhbQjc/PwNz@redhat.com> (raw)
In-Reply-To: <20210514182749.602087-1-ppalka@redhat.com>

On 14/05/21 14:27 -0400, Patrick Palka via Libstdc++ wrote:
>r11-8053 rewrote the range adaptor implementation in conformance with
>P2281, making partial application act like a SFINAE-friendly perfect
>forwarding call wrapper.  Making SFINAE-friendliness coexist with
>perfect forwarding here requires adding fallback deleted operator()
>overloads (as described in e.g. section 5.5 of wg21.link/p0847r6).  But
>unfortunately, as reported in PR100577, this necessary technique of
>using of deleted overloads regresses diagnostics for ill-formed calls to
>partially applied range adaptors in GCC.
>
>Although GCC's diagnostics can arguably be improved here by having the
>compiler explain why the other candidates weren't viable when overload
>resolution selects a deleted candidate, we can also largely work around
>this on the library side (and achieve more concise diagnostics than by
>a frontend-side improvement alone) if we take advantage of the
>observation that not all range adaptors need perfect forwarding call
>wrapper semantics, in fact only views::split currently needs it, because
>all other range adaptors either take no extra arguments or only
>arguments that are expected to be freely/cheaply copyable, e.g. function
>objects and integer-like types.  (The discussion section of P2281 goes
>into detail about why views::split is special.)
>
>To that end, this introduces opt-in flags for denoting a range adaptor
>as having "simple" extra arguments (in the case of a range adaptor
>non-closure) or having a "simple" call operator (in the case of a range
>adaptor closure).  These flags are then used to conditionally simplify
>the operator() for the generic _Partial and _Pipe class templates, down
>from needing three overloads thereof (including one defined as deleted)
>to just needing a single overload.  The end result is that diagnostic
>quality is restored for all adaptors except for views::split, and
>diagnostics for the adaptors are generally made more concise since
>there's only a single _Partial/_Pipe overload to diagnose instead of
>three of them.
>
>Tested on x86_64-pc-linux-gnu, does this look OK for trunk/11?

OK for trunk and 11.

Is there any benefit in using [[no_unique_address]] for
_Partial::_M_args too?


      parent reply	other threads:[~2021-06-03 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-14 18:27 Patrick Palka
2021-05-26 18:52 ` Patrick Palka
2021-06-03 12:10 ` Jonathan Wakely [this message]

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=YLjGznhbQjc/PwNz@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ppalka@redhat.com \
    /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).