Skip to content

Conversation

@Quuxplusone
Copy link
Contributor

This simplifies the codepaths after a4950fb. We can't use Clang's current __builtin_is_cpp_trivially_relocatable(T) for the same reason we continue to be unable to use Clang's current __is_trivially_relocatable(T): it returns true for polymorphic types and other types that aren't trivially relocatable in the Abseil/Folly/P1144 sense. We use memcpy for relocation; we use relocation to implement InlineVector::erase and InlineVector::swap. So, as the comment says, we care about wonky assignment as well as wonky copy-construction or destruction.

Use the public (not private/compiler-builtin!) API of P1144 wherever it's available. Never use the Clang builtins otherwise. Always fall back to the public (not private/compiler-builtin!) std::is_trivially_copyable when P1144 isn't available.

Remove references to P2786; it is not part of C++26 anymore, and even if it were, Abseil couldn't use it, because P2786 ignored move-assignment and also permitted "relocation" to fix up vptrs (which memcpy never does).

(Fixes #1885 in a different, shorter/correcter, way.)

This simplifies the codepaths after a4950fb. We can't use Clang's current
`__builtin_is_cpp_trivially_relocatable(T)` for the same reason we continue
to be unable to use Clang's current `__is_trivially_relocatable(T)`: it
returns true for polymorphic types and other types that aren't trivially
relocatable in the Abseil/Folly/P1144 sense. We use memcpy for relocation;
we use relocation to implement InlineVector::erase and InlineVector::swap.
So, as the comment says, we care about wonky assignment as well as wonky
copy-construction or destruction.

Use the public (not private/compiler-builtin!) API of P1144 wherever it's
available. Never use the Clang builtins otherwise. Always fall back to
the public (not private/compiler-builtin!) std::is_trivially_copyable
when P1144 isn't available.

Remove references to P2786; it is not part of C++26 anymore, and even if
it were, Abseil couldn't use it, because P2786 ignored move-assignment and
also permitted "relocation" to fix up vptrs (which memcpy never does).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: builtin __is_trivially_relocatable is deprecated

1 participant