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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So we have in original:
  <<cleanup_point return <retval> = (const double &) &TARGET_EXPR <D.13997,
std::__invoke_impl<double, constant_ref_broken<double>(const
double&)::<lambda()>&> (<<< Unknown tree: empty_class_expr >>>,
std::forward<constant_ref_broken<double>(const double&)::<lambda()>&> ((struct
type &) __fn))>;, 0>>;


Note the ,0 there.

The original code:
  template<typename _Res, typename _Callable, typename... _Args>
    constexpr __can_invoke_as_nonvoid<_Res, _Callable, _Args...>
    __invoke_r(_Callable&& __fn, _Args&&... __args)
    {
      using __result = __invoke_result<_Callable, _Args...>;
      using __type = typename __result::type;
      using __tag = typename __result::__invoke_type;
      return std::__invoke_impl<__type>(__tag{}, std::forward<_Callable>(__fn),
                                        std::forward<_Args>(__args)...);
    }


Note I think this is undefined code anyways, you are causing a return of a
reference to a local variable here.

Reply via email to