[clang] Sema: Fix CXXRecordDecl::isTriviallyCopyable() for classes with all deleted special functions. (PR #94831)

Amirreza Ashouri via cfe-commits cfe-commits at lists.llvm.org
Sat Jun 8 07:45:22 PDT 2024


AMP999 wrote:

You're currently checking whether there is at least one **deleted** member of **each** kind; but you should be checking whether there is at least one **non-deleted** member of **any** kind. A type that shows the difference is:
```
struct S {
  S(const S&) = default;
  S(S&) = delete;
  S(S&&) = delete;
  S& operator=(const S&) = default;
  S& operator=(S&) = delete;
  S& operator=(S&&) = delete;
};
static_assert(__is_trivially_copyable(S)); // should be true
```

https://github.com/llvm/llvm-project/pull/94831


More information about the cfe-commits mailing list