[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 16 04:49:51 PDT 2024
================
@@ -917,6 +917,18 @@ class QualType {
/// Return true if this is a trivially copyable type (C++0x [basic.types]p9)
bool isTriviallyCopyableType(const ASTContext &Context) const;
+ /// Return true if this is a bitwise copyable type.
+ ///
+ /// This is an extension in clang: bitwise copyable types act as trivially
+ /// copyable types, underlying bytes of bitwise copyable type can be safely
+ /// copied by memcpy or memmove. Clang guarantees that both source and
+ /// destination objects have the same **object** representations after the
+ /// copy, and the lifetime of the destination object implicitly starts.
+ ///
+ /// bitwise copyable types cover a wider range of types, e.g. classes with
----------------
hokein wrote:
than the trivially-copyable types. I think it may be better to remove it, to avoid this confusion.
https://github.com/llvm/llvm-project/pull/86512
More information about the cfe-commits
mailing list