xref: /llvm-project/libcxx/test/std/utilities/variant/variant.variant/variant.assign/conv.pass.cpp (revision 9e406ef4f4b089f88e74b2713f0fbee51b9537d6)
1128af315SEric Fiselier //===----------------------------------------------------------------------===//
2128af315SEric Fiselier //
3128af315SEric Fiselier // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4128af315SEric Fiselier // See https://llvm.org/LICENSE.txt for license information.
5128af315SEric Fiselier // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6128af315SEric Fiselier //
7128af315SEric Fiselier //===----------------------------------------------------------------------===//
8128af315SEric Fiselier 
931cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11, c++14
10128af315SEric Fiselier 
11128af315SEric Fiselier // <variant>
12128af315SEric Fiselier 
13128af315SEric Fiselier // template <class ...Types> class variant;
14128af315SEric Fiselier 
15128af315SEric Fiselier // template <class T>
16128af315SEric Fiselier // variant& operator=(T&&) noexcept(see below);
17128af315SEric Fiselier 
18128af315SEric Fiselier #include <variant>
19128af315SEric Fiselier #include <string>
20128af315SEric Fiselier #include <memory>
21128af315SEric Fiselier 
22cc89063bSNico Weber #include "variant_test_helpers.h"
23128af315SEric Fiselier 
main(int,char **)24128af315SEric Fiselier int main(int, char**)
25128af315SEric Fiselier {
26128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<int, int>, int>::value, "");
27128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<long, long long>, int>::value, "");
28*9e406ef4SLouis Dionne   static_assert(!std::is_assignable<std::variant<char>, int>::value, "");
29128af315SEric Fiselier 
30*9e406ef4SLouis Dionne   static_assert(!std::is_assignable<std::variant<std::string, float>, int>::value, "");
31*9e406ef4SLouis Dionne   static_assert(!std::is_assignable<std::variant<std::string, double>, int>::value, "");
32128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<std::string, bool>, int>::value, "");
33128af315SEric Fiselier 
34128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<int, bool>, decltype("meow")>::value, "");
35128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<int, const bool>, decltype("meow")>::value, "");
36128af315SEric Fiselier 
37170810fcSDavid Benjamin   static_assert(std::is_assignable<std::variant<bool>, std::true_type>::value, "");
38128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<bool>, std::unique_ptr<char> >::value, "");
39128af315SEric Fiselier   static_assert(!std::is_assignable<std::variant<bool>, decltype(nullptr)>::value, "");
40128af315SEric Fiselier 
4180e088e1SCasey Carter   return 0;
42128af315SEric Fiselier }
43