[Bug libstdc++/100940] views::take and views::drop should not define _S_has_simple_extra_args

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jun 7 16:32:58 GMT 2021


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2021-06-07
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Good point, confirmed.  Though I'm not sure if perfect forwarding here is
strictly necessary to fix this testcase.  Perhaps the _S_has_simple_extra_args
versions of _Partial should be forwarding the bound arguments as prvalues
instead of as const lvalues?

The following

--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -933,10 +933,10 @@ namespace views::__adaptor
       { }

       template<typename _Range>
-       requires __adaptor_invocable<_Adaptor, _Range, const _Arg&>
+       requires __adaptor_invocable<_Adaptor, _Range, _Arg>
        constexpr auto
        operator()(_Range&& __r) const
-       { return _Adaptor{}(std::forward<_Range>(__r), _M_arg); }
+       { return _Adaptor{}(std::forward<_Range>(__r),
static_cast<_Arg>(_M_arg)); }

       static constexpr bool _S_has_simple_call_op = true;
     };

would fix your example.


More information about the Gcc-bugs mailing list