https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121858
Tomasz Kamiński <tkaminsk at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkaminsk at gcc dot gnu.org
--- Comment #4 from Tomasz Kamiński <tkaminsk at gcc dot gnu.org> ---
LEWG explicitly decided that reference_wrapper does not have special handling
for function_ref, so your example is required to compile:
std::function_ref<void()> fr(std::nontype<&S::f>, sr);
However, fr will store pointer to sr, and will-start dangling as soon as it
goes out of scope. In other words, the rvalue-reference case would dangle
immediately, and make sense
that it is ill-formed.
std::function_ref<void()> fr(std::nontype<&S::f>, std::ref(s));