]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++11 } } |
f5e523b7 VV |
2 | // |
3 | // 2014-10-09 Ville Voutilainen <ville.voutilainen@gmail.com> | |
4 | // | |
85ec4feb | 5 | // Copyright (C) 2014-2018 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 | ||
25 | struct HasTemplateCAssign | |
26 | { | |
27 | HasTemplateCAssign& operator=(const HasTemplateCAssign&) = default; | |
28 | template <class T> | |
29 | HasTemplateCAssign& operator=(T&&); | |
30 | }; | |
31 | ||
32 | struct MoveOnly | |
33 | { | |
34 | MoveOnly& operator=(MoveOnly&&) = default; | |
35 | }; | |
36 | ||
37 | struct MoveOnly2 | |
38 | { | |
39 | MoveOnly2& operator=(MoveOnly2&&) = delete; | |
40 | }; | |
41 | ||
42 | void test01() | |
43 | { | |
44 | using std::is_trivially_assignable; | |
45 | using namespace __gnu_test; | |
46 | ||
47 | static_assert(test_property<is_trivially_assignable, | |
48 | int, int>(false), ""); | |
49 | static_assert(test_property<is_trivially_assignable, | |
50 | int&, int>(true), ""); | |
51 | static_assert(test_property<is_trivially_assignable, | |
52 | int&, int&>(true), ""); | |
53 | static_assert(test_property<is_trivially_assignable, | |
54 | int&, int&&>(true), ""); | |
55 | static_assert(test_property<is_trivially_assignable, | |
56 | int&, const int&>(true), ""); | |
57 | ||
58 | static_assert(test_property<is_trivially_assignable, | |
59 | TType, TType>(true), ""); | |
60 | static_assert(test_property<is_trivially_assignable, | |
61 | TType&, TType>(true), ""); | |
62 | static_assert(test_property<is_trivially_assignable, | |
63 | TType&, TType&>(true), ""); | |
64 | static_assert(test_property<is_trivially_assignable, | |
65 | TType&, TType&&>(true), ""); | |
66 | static_assert(test_property<is_trivially_assignable, | |
67 | TType&, const TType&>(true), ""); | |
68 | static_assert(test_property<is_trivially_assignable, | |
69 | PODType, PODType>(true), ""); | |
70 | static_assert(test_property<is_trivially_assignable, | |
71 | NType&, NType&>(false), ""); | |
72 | static_assert(test_property<is_trivially_assignable, | |
73 | SLType, SLType>(true), ""); | |
74 | static_assert(test_property<is_trivially_assignable, | |
75 | assign::Empty, assign::Empty>(true), ""); | |
76 | static_assert(test_property<is_trivially_assignable, | |
77 | assign::Abstract, assign::Abstract>(false), ""); | |
78 | static_assert(test_property<is_trivially_assignable, | |
79 | assign::Ellipsis, assign::Ellipsis>(true), ""); | |
80 | static_assert(test_property<is_trivially_assignable, | |
81 | assign::DelEllipsis, assign::DelEllipsis>(true), ""); | |
82 | static_assert(test_property<is_trivially_assignable, | |
83 | assign::Any, assign::Any>(true), ""); | |
84 | static_assert(test_property<is_trivially_assignable, | |
85 | assign::DelDef, assign::DelDef>(true), ""); | |
86 | static_assert(test_property<is_trivially_assignable, | |
87 | assign::DelCopy, assign::DelCopy>(true), ""); | |
88 | static_assert(test_property<is_trivially_assignable, | |
89 | assign::Nontrivial, assign::Nontrivial>(false), ""); | |
90 | static_assert(test_property<is_trivially_assignable, | |
91 | assign::AnyAssign, assign::AnyAssign>(true), ""); | |
92 | static_assert(test_property<is_trivially_assignable, | |
93 | assign::DelAnyAssign, assign::DelAnyAssign>(true), ""); | |
94 | static_assert(test_property<is_trivially_assignable, | |
95 | assign::DelCopyAssign, assign::DelCopyAssign>(true), ""); | |
96 | static_assert(test_property<is_trivially_assignable, | |
97 | assign::MO, assign::MO>(true), ""); | |
98 | static_assert(test_property<is_trivially_assignable, | |
99 | assign::MO, assign::MO&&>(true), ""); | |
100 | static_assert(test_property<is_trivially_assignable, | |
101 | assign::MO, assign::MO&>(false), ""); | |
102 | static_assert(test_property<is_trivially_assignable, | |
103 | assign::MO, const assign::MO&>(false), ""); | |
104 | static_assert(test_property<is_trivially_assignable, | |
105 | CopyConsOnlyType, CopyConsOnlyType>(false), ""); | |
106 | static_assert(test_property<is_trivially_assignable, | |
107 | CopyConsOnlyType, const CopyConsOnlyType&>(false), ""); | |
108 | static_assert(test_property<is_trivially_assignable, | |
109 | MoveConsOnlyType, MoveConsOnlyType>(false), ""); | |
110 | static_assert(test_property<is_trivially_assignable, | |
111 | MoveConsOnlyType, MoveConsOnlyType&&>(false), ""); | |
112 | static_assert(test_property<is_trivially_assignable, | |
113 | HasTemplateCAssign, HasTemplateCAssign>(false), ""); | |
114 | static_assert(test_property<is_trivially_assignable, | |
115 | HasTemplateCAssign, const HasTemplateCAssign&>(true), ""); | |
116 | static_assert(test_property<is_trivially_assignable, | |
117 | ClassType, DerivedType>(true), ""); | |
118 | static_assert(test_property<is_trivially_assignable, | |
119 | ClassType, DerivedType&>(true), ""); | |
120 | static_assert(test_property<is_trivially_assignable, | |
121 | ClassType, DerivedType&&>(true), ""); | |
122 | static_assert(test_property<is_trivially_assignable, | |
123 | ClassType, const DerivedType&>(true), ""); | |
124 | static_assert(test_property<is_trivially_assignable, | |
125 | MoveOnly, MoveOnly>(true), ""); | |
126 | static_assert(test_property<is_trivially_assignable, | |
127 | MoveOnly, MoveOnly&&>(true), ""); | |
128 | static_assert(test_property<is_trivially_assignable, | |
129 | MoveOnly, MoveOnly&>(false), ""); | |
130 | static_assert(test_property<is_trivially_assignable, | |
131 | MoveOnly, const MoveOnly&>(false), ""); | |
132 | static_assert(test_property<is_trivially_assignable, | |
133 | MoveOnly2, MoveOnly2>(false), ""); | |
134 | } |