[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:13 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;
+};
+
+static_assert(!std::is_trivially_copy_constructible<NoThrowNTCopy>::value, "");
+static_assert(std::is_copy_constructible<NoThrowNTCopy>::value, "");
----------------
frederick-vs-ja wrote:
I think we should use C++17 things. It's valueless to me to keep the consistency with the existing pre-C++17-styled lines.
```suggestion
static_assert(!std::is_trivially_copy_constructible_v<NoThrowNTCopy>);
static_assert(std::is_copy_constructible_v<NoThrowNTCopy>);
```
https://github.com/llvm/llvm-project/pull/230241
More information about the libcxx-commits
mailing list