mirror of git://gcc.gnu.org/git/gcc.git
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> |
||
|---|---|---|
| .. | ||
| assign.cc | ||
| call.cc | ||
| cons.cc | ||
| cons_neg.cc | ||
| conv.cc | ||
| deduction.cc | ||
| incomplete_neg.cc | ||
| mutation.cc | ||