================
@@ -1826,6 +1827,12 @@ The following type trait primitives are supported by 
Clang. Those traits marked
   functionally equivalent to copying the underlying bytes and then dropping the
   source object on the floor. This is true of trivial types and types which
   were made trivially relocatable via the ``clang::trivial_abi`` attribute.
+* ``__builtin_is_cpp_trivially_relocatable`` (C++): Returns true if an object
+  is trivially relocatable, as defined by the C++26 standard [meta.unary.prop].
+  Note that the caller code should ensure that if the object is polymorphic,
+  the dynamic type is of the most derived type.
----------------
cor3ntin wrote:

`std::is_trivially_relocatable` should *not* return true for a type that is not 
relocatable per the standard.

This gives us a few options, none of them great
- Introduce a new trait so that we can model the standard behavior
- Modify the existing trait to ignore `[[clang::trivial_abi]]`  which _will_ 
break code
- Be not conforming

Having a warning does not solve the conformance issue.
I agree with you that we probably want
 - Restrict the set of types that can be  `[[clang::trivial_abi]]`  (ie warn if 
 `[[clang::trivial_abi]]`  is added to a non-relocatable type)
 - Converge to a single trait by deprecating the old trait.



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

Reply via email to