[PATCH] D92361: [trivial-abi] Support types without a copy or move constructor.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 4 10:49:56 PST 2020
rjmccall added a comment.
In D92361#2433775 <https://reviews.llvm.org/D92361#2433775>, @Quuxplusone wrote:
> In D92361#2433190 <https://reviews.llvm.org/D92361#2433190>, @rjmccall wrote:
>
>> There is no such thing as an object "teleporting" in C++. Objects are always observed in memory with a specific address. When an argument is passed in registers, its address can be observed to be different on both sides, and that is not permitted; there must be some operation that creates the object at the new address and destroys it at the old.
>
> That's where you're wrong (about C++). You might be right about C or Objective-C, I don't know. In C++, that "teleporting" happens //without// any call to a special member — there is no move happening, and no destroy happening. You can actually observe this: https://godbolt.org/z/zojooc The object is simply "bitwise-teleported" from one place to another. Standard C++17 says that this is a "guaranteed-copy-elision" context; there is indeed only one C++ "object" here. It just happens to blit around in memory //beyond// what the C++ code is doing to it.
I think perhaps we are talking past each other and have reached the limits of what this sub-thread can hope to achieve.
John.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92361/new/
https://reviews.llvm.org/D92361
More information about the cfe-commits
mailing list