abseil's absl::is_trivially_copy_assignable uses deprecated, broken compiler builtin
royjacobson opened this issue · comments
As a side effect of implementing DR2171 for clang, we have discovered that absl::is_trivially_copy_assignable
uses the __has_trivial_assign
compiler builtin.
This compiler builtin has bad semantics when deleted functions are involved because clang considers them trivial for this purpose. Specifically it appears that MSVC stl delete the copy assignment operator for volatile& std::pair
which causes abseil to assert when instantiating absl::Optional<std::pair<int, int>>
with MSVC stl.
This has been discussed over at https://reviews.llvm.org/D127593. We might revert this change momentarily, but it would be helpful if abseil will stop using the __has_trivial...
builtins.
Note that GCC uses the same 'deleted is trivial' semantics as clang, and that those builtins have been deprecated for quite some time: this is a discussion of the same issue from 2017: llvm/llvm-project#33063
On the Mozilla side: https://bugzilla.mozilla.org/show_bug.cgi?id=1779528 (firefox uses libwebrtc which uses abseil-cpp)
In addition to __has_trivial_assign
, abseil uses __has_trivial_copy
and __has_trivial_constructor
in type_traits.h which are also deprecated.