public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/111535] New: _RangeAdaptorClosure's (range | adaptor) operator is underconstrained
@ 2023-09-22  8:55 hewillk at gmail dot com
  0 siblings, 0 replies; only message in thread
From: hewillk at gmail dot com @ 2023-09-22  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111535
           Summary: _RangeAdaptorClosure's (range | adaptor) operator is
                    underconstrained
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

// range | adaptor is equivalent to adaptor(range).
    template<typename _Self, typename _Range>
    requires __is_range_adaptor_closure<_Self>
      && __adaptor_invocable<_Self, _Range>
    constexpr auto
    operator|(_Range&& __r, _Self&& __self)
    { return std::forward<_Self>(__self)(std::forward<_Range>(__r)); }

The pipe operator here does not constrain the Range template parameter, but the
range adaptor closure object requires arguments to model the range.

This makes libstdc++ accept the following

#include <ranges>

struct closure : std::ranges::range_adaptor_closure<closure> {
  int operator()(int);
};

int main() {
  auto r = 42 | closure{};
}

https://godbolt.org/z/hj9a68ssT

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-22  8:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22  8:55 [Bug libstdc++/111535] New: _RangeAdaptorClosure's (range | adaptor) operator is underconstrained 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).