summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/variant
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2019-05-13 14:56:02 +0000
committerMarshall Clow <mclow.lists@gmail.com>2019-05-13 14:56:02 +0000
commit98c7c4fad25df52b8a4c7a6e1fa65824b84a813f (patch)
tree33686b32b2fe2768c2a1d1d6932eb939d4d35c00 /libcxx/test/std/utilities/variant
parent05dafb1c97de8f3dbb8a883f96c6ae452dcc6ef4 (diff)
downloadbcm5719-llvm-98c7c4fad25df52b8a4c7a6e1fa65824b84a813f.tar.gz
bcm5719-llvm-98c7c4fad25df52b8a4c7a6e1fa65824b84a813f.zip
Add a test for LWG#3204 and mark it as complete. Reviewed as https://reviews.llvm.org/D61829 Thanks to Zoe for the patch.
llvm-svn: 360586
Diffstat (limited to 'libcxx/test/std/utilities/variant')
-rw-r--r--libcxx/test/std/utilities/variant/variant.variant/variant.assign/copy.fail.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.assign/copy.fail.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.assign/copy.fail.cpp
new file mode 100644
index 00000000000..46e26e71384
--- /dev/null
+++ b/libcxx/test/std/utilities/variant/variant.variant/variant.assign/copy.fail.cpp
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// <variant>
+
+// LWG issue 3024
+
+#include <variant>
+#include <type_traits>
+
+struct NotCopyConstructible
+{
+ NotCopyConstructible() = default;
+ NotCopyConstructible(NotCopyConstructible const&) = delete;
+};
+
+int main(int, char**)
+{
+ static_assert(!std::is_copy_constructible_v<NotCopyConstructible>);
+
+ std::variant<NotCopyConstructible> v;
+ std::variant<NotCopyConstructible> v1;
+ std::variant<NotCopyConstructible> v2(v); // expected-error {{call to implicitly-deleted copy constructor of 'std::variant<NotCopyConstructible>'}}
+ v1 = v; // expected-error {{object of type 'std::__1::variant<NotCopyConstructible>' cannot be assigned because its copy assignment operator is implicitly deleted}}
+}
OpenPOWER on IntegriCloud