[clang] [clang] Implement a bitwise_copyable builtin type trait. (PR #86512)
A. Jiang via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 5 23:09:00 PDT 2024
frederick-vs-ja wrote:
IIUC this intrinsic is unrelated to assignment operators. Do you have any plan for `__is_bitwise_assignable`, which should determine whether the assignment operator equivalently copies the value representation, possibly modulo the vptrs?
```C++
struct Cat {}; // bitwise copy assignable
struct Leopard : Cat { // is_trivially_assignable_v returns true but not bitwise copy assignable
int spots_;
Leopard& operator=(Leopard&) = delete;
using Cat::operator=; // We can detect this by metaprogramming as operator= overloads have wrong types.
};
struct LeopardHouse { // is_trivially_assignable_v returns true but not bitwise copy assignable
Leopard _;
// Non-bitwise-assignability *can't* be detected by metaprogramming since operator= overloads have right types.
};
```
https://github.com/llvm/llvm-project/pull/86512
More information about the cfe-commits
mailing list