[libcxx-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Nov 21 08:21:01 PST 2025
================
@@ -157,6 +157,10 @@ This flag adds ``[[clang::trivial_abi]]`` to ``unique_ptr``, which makes it triv
---------------------------------------------
This flag adds ``[[clang::trivial_abi]]`` to ``shared_ptr``, which makes it trivial for the purpose of calls.
+``_LIBCPP_ABI_MOVE_ONLY_FUNCTION_TRIVIAL_ABI``
----------------
ldionne wrote:
It's a bummer that we can't enable this by default due to GCC compatibility (since they don't provide the trivial-abi attribute). It's unfortunate to pessimize the implementation for everyone just for compatibility in a niche use case.
Instead, as we discussed just now, we could unconditionally apply `[[trivial_abi]]` to the class, but not provide it on GCC until they implement the attribute. That way, we prevent ABI incompatibilities and we don't pessimize the implementation for everyone. And we're technically not making things worse for anyone on GCC, since libc++ doesn't implement `move_only_function` on any compiler at the moment.
So, remove this ABI configuration and make `move_only_function` unavailable on GCC (until they implement `[[trivial_abi]]`).
https://github.com/llvm/llvm-project/pull/94670
More information about the libcxx-commits
mailing list