]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: fix __is_invocable for std::reference_wrapper [PR121055]
authorPatrick Palka <ppalka@redhat.com>
Wed, 23 Jul 2025 12:31:46 +0000 (08:31 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 24 Jul 2025 12:57:12 +0000 (08:57 -0400)
commit80a51dae8b9af3f6b318f8ed71c67aab96a3fc91
tree6a84b293a0d803e158fef128abdb3f0c5b7c51e1
parent5a29c9147404c0473e009df879e7467ff4948820
c++: fix __is_invocable for std::reference_wrapper [PR121055]

Our implementation of the INVOKE spec ([func.require]) was incorrectly
treating reference_wrapper<T>::get() as returning T instead of T&, which
notably makes a difference when invoking a ref-qualified memfn pointer.

PR c++/121055

gcc/cp/ChangeLog:

* method.cc (build_invoke): Correct reference_wrapper handling.

gcc/testsuite/ChangeLog:

* g++.dg/ext/is_invocable5.C: New test.

Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 04a176a1d84a84c630cfd4d232736c12b105957a)
gcc/cp/method.cc
gcc/testsuite/g++.dg/ext/is_invocable5.C [new file with mode: 0644]