[libcxx-commits] [libcxx] [libc++] Implement LWG2991: variant copy constructor missing noexcept(see below) (PR #230241)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 9 04:28:26 PDT 2026


================
@@ -99,6 +109,28 @@ void makeEmpty(Variant& v) {
 }
 #endif // TEST_HAS_NO_EXCEPTIONS
 
+constexpr void test_copy_noexcept() {
+  {
+    using V = std::variant<int, long>;
+    static_assert(std::is_nothrow_copy_constructible<V>::value, "");
+  }
+  {
+    using V = std::variant<int, TCopy>;
+    static_assert(std::is_nothrow_copy_constructible<TCopy>::value, "");
----------------
KaroliShp wrote:

I placed the checks here deliberately, but I see how that's confusing. I moved the checks next to the types

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


More information about the libcxx-commits mailing list