[libcxx-commits] [libcxx] [libc++] make std::atomic works with types with paddings (PR #76180)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 22 11:25:57 PST 2023
================
@@ -26,6 +27,32 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR void __clear_padding_if_needed(_Tp* __ptr) noexcept {
+#if _LIBCPP_STD_VER >= 20
+ constexpr bool __needs_clear_padding =
+ !__has_unique_object_representations(_Tp) && !is_same<_Tp, float>::value && !is_same<_Tp, double>::value;
+ if constexpr (__needs_clear_padding) {
+ if (!__builtin_is_constant_evaluated()) {
----------------
mordante wrote:
why not `std::is_constant_evaluated`?
https://github.com/llvm/llvm-project/pull/76180
More information about the libcxx-commits
mailing list