]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/is_trivially_move_assignable/value.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / is_trivially_move_assignable / value.cc
CommitLineData
52066eae 1// { dg-do compile { target c++11 } }
f5e523b7
VV
2//
3// 2014-10-09 Ville Voutilainen <ville.voutilainen@gmail.com>
4//
8d9254fc 5// Copyright (C) 2014-2020 Free Software Foundation, Inc.
f5e523b7
VV
6//
7// This file is part of the GNU ISO C++ Library. This library is free
8// software; you can redistribute it and/or modify it under the
9// terms of the GNU General Public License as published by the
10// Free Software Foundation; either version 3, or (at your option)
11// any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License along
19// with this library; see the file COPYING3. If not see
20// <http://www.gnu.org/licenses/>.
21
22#include <type_traits>
23#include <testsuite_tr1.h>
24
25struct HasTemplateCAssign
26{
27 HasTemplateCAssign& operator=(const HasTemplateCAssign&) = default;
28 template <class T>
29 HasTemplateCAssign& operator=(T&&);
30};
31
32struct MoveOnly
33{
34 MoveOnly& operator=(MoveOnly&&) = default;
35};
36
37struct MoveOnly2
38{
39 MoveOnly2& operator=(MoveOnly2&&) = delete;
40};
41
42void test01()
43{
44 using std::is_trivially_move_assignable;
45 using namespace __gnu_test;
46
47 static_assert(test_property<is_trivially_move_assignable,
48 int>(true), "");
49 static_assert(test_property<is_trivially_move_assignable,
50 TType>(true), "");
51 static_assert(test_property<is_trivially_move_assignable,
52 PODType>(true), "");
53 static_assert(test_property<is_trivially_move_assignable,
54 NType>(false), "");
55 static_assert(test_property<is_trivially_move_assignable,
56 SLType>(true), "");
57 static_assert(test_property<is_trivially_move_assignable,
58 assign::Empty>(true), "");
59 static_assert(test_property<is_trivially_move_assignable,
60 assign::Abstract>(false), "");
61 static_assert(test_property<is_trivially_move_assignable,
62 assign::Ellipsis>(true), "");
63 static_assert(test_property<is_trivially_move_assignable,
64 assign::DelEllipsis>(true), "");
65 static_assert(test_property<is_trivially_move_assignable,
66 assign::Any>(true), "");
67 static_assert(test_property<is_trivially_move_assignable,
68 assign::DelDef>(true), "");
69 static_assert(test_property<is_trivially_move_assignable,
70 assign::DelCopy>(true), "");
71 static_assert(test_property<is_trivially_move_assignable,
72 assign::Nontrivial>(false), "");
73 static_assert(test_property<is_trivially_move_assignable,
74 assign::AnyAssign>(true), "");
75 static_assert(test_property<is_trivially_move_assignable,
76 assign::DelAnyAssign>(true), "");
77 static_assert(test_property<is_trivially_move_assignable,
78 assign::DelCopyAssign>(true), "");
79 static_assert(test_property<is_trivially_move_assignable,
80 assign::MO>(true), "");
81 static_assert(test_property<is_trivially_move_assignable,
82 CopyConsOnlyType>(false), "");
83 static_assert(test_property<is_trivially_move_assignable,
84 MoveConsOnlyType>(false), "");
85 static_assert(test_property<is_trivially_move_assignable,
86 HasTemplateCAssign>(false), "");
87 static_assert(test_property<is_trivially_move_assignable,
88 MoveOnly>(true), "");
89 static_assert(test_property<is_trivially_move_assignable,
90 MoveOnly2>(false), "");
b42cc3ca
VV
91 static_assert(test_property<is_trivially_move_assignable,
92 void>(false), "");
f5e523b7 93}