Issue 143599
Summary Trivial relocatability/replaceability of class with user-provided defaulted destructor
Labels new issue
Assignees
Reporter jakubjelinek
    I've tried to turn the https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2786r13.html#simple-worked-examples examples into a testcase:
https://godbolt.org/z/h4We6c8KM
Trying this with clang and gcc (in that case using __is_* traits rather than the __builtin_is_cpp_* or __builtin_is_* ones), I get similar results (tons of failed assertions, will need to go through that, wonder if it is from some earlier version of the paper not updated afterwards or what) between the two compilers, except for the
```c
struct I { ~I (); };
I::~I () = default;

static_assert (!std::is_trivially_copyable_v <I>, "");
static_assert (!std::is_trivially_relocatable_v <I>, "");
static_assert (!std::is_replaceable_v <I>, "");
```
testcase in there, where it passes with GCC but the last 2 assertions fail with clang trunk.
My reading of the standard is that I has user-provided destructor and so according to
https://eel.is/c++draft/class.prop#2.3
shouldn't be default-movable and while it is eligible for trivial relocation and eligible for replacement, because it doesn't have the conditional keywords and is not a union, it should be neither trivially relocatable nor replaceable.

BTW, as the appendix says,
```c
struct C {}; struct C replaceable_if_eligible {};
```
should be valid in C++11 through C++23, but clang trunk rejects that.

@cor3ntin 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to