[libcxx-commits] [libcxx] [libc++] Implement LWG2991: variant copy constructor missing noexcept(see below) (PR #230241)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 9 02:50:12 PDT 2026
================
@@ -52,6 +52,16 @@ struct NTCopy {
static_assert(!std::is_trivially_copy_constructible<NTCopy>::value, "");
static_assert(std::is_copy_constructible<NTCopy>::value, "");
+struct NoThrowNTCopy {
+ constexpr NoThrowNTCopy(int v) : value(v) {}
+ NoThrowNTCopy(const NoThrowNTCopy& that) noexcept : value(that.value) {}
+ NoThrowNTCopy(NoThrowNTCopy&&) = delete;
+ int value;
+};
----------------
frederick-vs-ja wrote:
It seems that we don't even (odr-) use the copy ctor, so we don't need it to be defined. The data member and the move ctor seem irrelavent.
```suggestion
struct NoThrowNTCopy {
NoThrowNTCopy(const NoThrowNTCopy&) noexcept;
};
```
https://github.com/llvm/llvm-project/pull/230241
More information about the libcxx-commits
mailing list