[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


================
@@ -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, "");
----------------
frederick-vs-ja wrote:

Is this line, which is not related to `variant`, misplaced? Ditto below.

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


More information about the libcxx-commits mailing list