|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4 |
|
| #
c3a24882 |
| 24-May-2022 |
Aaron Jacobs <jacobsa@google.com> |
[libc++] type_traits: use __is_core_convertible in __invokable_r.
This fixes incorrect handling of non-moveable types, adding tests for this case. See [issue 55346](https://github.com/llvm/llvm-proj
[libc++] type_traits: use __is_core_convertible in __invokable_r.
This fixes incorrect handling of non-moveable types, adding tests for this case. See [issue 55346](https://github.com/llvm/llvm-project/issues/55346).
The current implementation is based on is_convertible, which is [defined](https://timsong-cpp.github.io/cppwp/n4659/meta.rel#5) in terms of validity of the following function:
``` To test() { return declval<From>(); } ```
But this doesn't work if To and From are both some non-moveable type, which the [definition](https://timsong-cpp.github.io/cppwp/n4659/conv#3) of implicit conversions says should work due to guaranteed copy elision:
``` To to = E; // E has type From ```
It is this latter definition that is used in the [definition](https://timsong-cpp.github.io/cppwp/n4659/function.objects#func.require-2) of INVOKE<R>. Make __invokable_r use __is_core_convertible, which captures the ability to use guaranteed copy elision, making the definition correct for non-moveable types.
Fixes llvm/llvm-project#55346.
Reviewed By: #libc, philnik, EricWF
Spies: EricWF, jloser, ldionne, philnik, libcxx-commits
Differential Revision: https://reviews.llvm.org/D125300
show more ...
|