================
@@ -4431,7 +4431,11 @@ destroy the object before returning. The lifetime of the 
copy of the parameter
 in the caller ends without a destructor call when the call begins.
 
 If a type is trivial for the purpose of calls, it is assumed to be trivially
-relocatable for the purpose of ``__is_trivially_relocatable``.
+relocatable for the purpose of ``__is_trivially_relocatable`` and
+``__builtin_is_cpp_trivially_relocatable``.
+The copy constructor of an object of such type might not be called
+when the object is passed to a function. Therefore, the ``trivial_abi``
+attribute should not be applied to objects that contain pointers to themselves.
----------------
erichkeane wrote:

What about something like...
```
When used as a function argument, this attribute instructs the compiler it may 
omit the call to the copy constructor. Thus, side effects of the copy 
constructor are potentially not executed.  For example, objects that contain 
pointers to themselves or sub-objects that would be updated during a copy 
should not be marked as trivial.
```

I'm not THRILLED with my last sentence, so feel free to come up with somethign 
better.

https://github.com/llvm/llvm-project/pull/143243
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to