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

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> ---
Thanks for the report.

The const-qualified transform_view::begin() member has as its constraints

      constexpr _Iterator<true>
      begin() const
        requires range<const _Vp>
          && regular_invocable<const _Fp&, range_reference_t<const _Vp>>.

So as part of overload resolution of the implicit call to
'transform_view::begin', we end up evaluating 'is_invocable_v<lambda, const
int&>'.  But because the lambda's return type is omitted and because evaluation
of 'is_invocable_v' requires knowing the return type, we have to instantiate
the body of the lambda in order to deduce its return type.  And instantiation
leads to a hard error from the failed static_assert.

So noe workaround here is to give the lambda an explicit return type.

Reply via email to