public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100567] New: views::take and views::drop should conditionally use _RangeAdaptor::operator()
@ 2021-05-12 13:18 hewillk at gmail dot com
  2021-05-12 17:58 ` [Bug libstdc++/100567] " ppalka at gcc dot gnu.org
  2021-05-13  2:06 ` hewillk at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: hewillk at gmail dot com @ 2021-05-12 13:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100567
           Summary: views::take and views::drop should conditionally use
                    _RangeAdaptor::operator()
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Hi, the re-implemented range adaptors use _RangeAdaptor to handle the arg of
the adaptors, but for views::take and views::drop, the constraint that this arg
can perfectly forward to range::range_difference_t<V> is lacking.

https://godbolt.org/z/j88q5Yn6Y

#include <ranges>
struct S {
  operator int() { return 0; }
};
const S obj;
auto r  = std::views::iota(0, 3);
auto d1 = r | std::views::drop(obj); // ok, should error
auto d2 = std::views::drop(r, obj);  // error
auto f1 = r | std::views::take(obj); // ok, should error
auto f2 = std::views::take(r, obj);  // error

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/100567] views::take and views::drop should conditionally use _RangeAdaptor::operator()
  2021-05-12 13:18 [Bug libstdc++/100567] New: views::take and views::drop should conditionally use _RangeAdaptor::operator() hewillk at gmail dot com
@ 2021-05-12 17:58 ` ppalka at gcc dot gnu.org
  2021-05-13  2:06 ` hewillk at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-12 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, I believe we're behaving correctly according to wg21.link/p2281.  This
paper clarifies that partial application of a range adaptor stores the extra
arguments in their decayed form, so in particular we discard their
cv-qualifications.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libstdc++/100567] views::take and views::drop should conditionally use _RangeAdaptor::operator()
  2021-05-12 13:18 [Bug libstdc++/100567] New: views::take and views::drop should conditionally use _RangeAdaptor::operator() hewillk at gmail dot com
  2021-05-12 17:58 ` [Bug libstdc++/100567] " ppalka at gcc dot gnu.org
@ 2021-05-13  2:06 ` hewillk at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: hewillk at gmail dot com @ 2021-05-13  2:06 UTC (permalink / raw)
  To: gcc-bugs

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

康桓瑋 <hewillk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Patrick Palka from comment #1)
> Hmm, I believe we're behaving correctly according to wg21.link/p2281.  This
> paper clarifies that partial application of a range adaptor stores the extra
> arguments in their decayed form, so in particular we discard their
> cv-qualifications.

Oops, you are right. Tim made a big change to the range adaptor objects in
P2281. Thank you for correcting me.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-13  2:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 13:18 [Bug libstdc++/100567] New: views::take and views::drop should conditionally use _RangeAdaptor::operator() hewillk at gmail dot com
2021-05-12 17:58 ` [Bug libstdc++/100567] " ppalka at gcc dot gnu.org
2021-05-13  2:06 ` hewillk at gmail dot com

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).