devin.jeanpierre added a comment.
In D114732#3178312 <https://reviews.llvm.org/D114732#3178312>, @rjmccall wrote:
> Trivial relocation doesn't imply that types have to be safe against being
> suddenly relocated during the middle of operations while they're not in a
> safe internal state. That is not a consideration.
In fact, I want to walk back that concern altogether. As a simple example, I
think `swap()` is allowed to be defined as so:
template <typename T>
void swap(T& lhs, T& rhs) {
([&](T tmp) {lhs = std::move(rhs); rhs =
std::move(tmp);})(std::move(lhs));
}
It's really hard to argue that a type can sensibly call out to library code
while in a state that is non-relocatable, despite self-labeling as
`[[clang::trivial_abi]]`. If the library is allowed to move the value, it's
allowed to move it into a parameter, causing a relocation! So I actually regret
pointing them out, or thinking that they might be a concern. :)
(Demonstration code: https://godbolt.org/z/j88Kqd49a)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114732/new/
https://reviews.llvm.org/D114732
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits