[libcxx-commits] [libcxx] [libc++] LWG3918: copy elision in `std::uninitialized_move/_n` (PR #207692)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 6 18:56:16 PDT 2026


================
@@ -56,6 +56,40 @@ int ThrowsCounted::count = 0;
 int ThrowsCounted::constructed = 0;
 int ThrowsCounted::throw_after = 0;
 
+struct NoMoveNoCopy {
+  constexpr explicit NoMoveNoCopy(int x) : value(x) {}
+  NoMoveNoCopy(NoMoveNoCopy const&) { assert(false); }
+  NoMoveNoCopy(NoMoveNoCopy const&&) { assert(false); }
----------------
frederick-vs-ja wrote:

I think we should delete the copy constructor. The declaration move constructor will be suppressed so the class will also be non-movable.

Also, as a nitpick, I think west `const` is preferred.
```suggestion
  NoMoveNoCopy(const NoMoveNoCopy&) = delete;
```

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


More information about the libcxx-commits mailing list