diff options
| author | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-10-24 16:45:59 +0200 |
|---|---|---|
| committer | Tomasz Kamiński <tkaminsk@redhat.com> | 2025-11-18 11:51:16 +0100 |
| commit | ac45382d0c06bc1a90ce74e0379e52496ab3bffe (patch) | |
| tree | 7fd963d9e5b1bfbadccd0658a102c0546fa2fb93 /libjava/classpath/java/io/FileNotFoundException.java | |
| parent | 594dc80c8e49cb65f77a13c201a0bea9423329ec (diff) | |
libstdc++: Fix construction function_ref from nontype<&S::x> and reference_wrapper [PR121858]
To reduce instantiation count, function_ref(nontype<&S::x>, r) previously
reused the invoker from function_ref(nontype<&S::x>, &r). This assumed r was
always a reference to S or a derived class. However, this constructor is also
valid for lvalues (but not rvalues) of reference_wrapper specializations.
This patch fixes this by limiting above optimization only to situations,
when argument is not specialization of reference_wrapper. This is achieved
bu comparing __inv_unwrap<_Td>::type with _Td. We use __inv_unwrap because
unwrap_reference_t does not handle cv-qualified types.
PR libstdc++/121858
libstdc++-v3/ChangeLog:
* include/bits/funcref_impl.h
(function_ref::function_ref(nontype<__fn>, _Up&&)): Handle.
reference_wrapper.
* testsuite/20_util/function_ref/call.cc: Call and update
test05(). Add new test06() for reference_wrapper.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diffstat (limited to 'libjava/classpath/java/io/FileNotFoundException.java')
0 files changed, 0 insertions, 0 deletions
