Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / variant / variant.variant / variant.assign / copy.verify.cpp
blobfe4961b4c157a54151b179dbc606bf7e2d3c24e8
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
11 // <variant>
13 // LWG issue 3024
15 #include <variant>
16 #include <type_traits>
18 struct NotCopyConstructible
20 NotCopyConstructible() = default;
21 NotCopyConstructible(NotCopyConstructible const&) = delete;
24 int main(int, char**)
26 static_assert(!std::is_copy_constructible_v<NotCopyConstructible>);
28 std::variant<NotCopyConstructible> v;
29 std::variant<NotCopyConstructible> v1;
30 std::variant<NotCopyConstructible> v2(v); // expected-error {{call to implicitly-deleted copy constructor of 'std::variant<NotCopyConstructible>'}}
31 v1 = v; // expected-error-re {{object of type 'std:{{.*}}:variant<NotCopyConstructible>' cannot be assigned because its copy assignment operator is implicitly deleted}}