1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
16 #include <type_traits>
18 struct NotCopyConstructible
20 NotCopyConstructible() = default;
21 NotCopyConstructible(NotCopyConstructible
const&) = delete;
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}}