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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to 康桓瑋 from comment #0)
> This constructor invokes the member pointer on a pointer to object _Up when
> _Fn is a member pointer.
> 
> However, _Up can be a std::reference_wrapper because std::invoke supports
> wrapping objects with std::ref. In this case, the call is ill-formed.
> 
> The following case is valid and should print hello:
> 
> #include <functional>
> 
> struct S { void f(); };
> 
> int main() {
>   S s;
>   auto sr = std::ref(s);
>   std::function_ref<void()> fr(std::nontype<&S::f>, sr);
>   fr();
> }
> 
> https://godbolt.org/z/4P1Eo17oj

..if f() prints hello.

Reply via email to