]>
Commit | Line | Data |
---|---|---|
f524d5b3 VV |
1 | // { dg-do compile { target c++11 } } |
2 | ||
a945c346 | 3 | // Copyright (C) 2016-2024 Free Software Foundation, Inc. |
f524d5b3 VV |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | // | |
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | #include <utility> | |
21 | ||
22 | #include <type_traits> | |
23 | #include <memory> | |
24 | ||
25 | using namespace std; | |
26 | ||
27 | struct Poison | |
28 | { | |
29 | Poison(Poison&&) = delete; | |
30 | }; | |
31 | ||
32 | struct ThrowingCopy | |
33 | { | |
98910bc2 PC |
34 | ThrowingCopy(const ThrowingCopy&); |
35 | ThrowingCopy& operator=(const ThrowingCopy&); | |
f524d5b3 VV |
36 | }; |
37 | ||
38 | int main() | |
39 | { | |
40 | static_assert(!is_copy_constructible<Poison>::value, ""); | |
41 | static_assert(!is_move_constructible<Poison>::value, ""); | |
42 | static_assert(!is_copy_assignable<Poison>::value, ""); | |
43 | static_assert(!is_move_assignable<Poison>::value, ""); | |
44 | static_assert(!is_copy_constructible<std::pair<int, Poison>>::value, | |
45 | ""); | |
46 | static_assert(!is_move_constructible<std::pair<int, Poison>>::value, | |
47 | ""); | |
48 | static_assert(!is_copy_assignable<std::pair<int, Poison>>::value, ""); | |
49 | static_assert(!is_move_assignable<std::pair<int, Poison>>::value, ""); | |
50 | static_assert(!is_constructible<std::pair<int, Poison>&, | |
51 | std::pair<char, Poison>&>::value, ""); | |
52 | static_assert(!is_assignable<std::pair<int, Poison>&, | |
53 | std::pair<char, Poison>&>::value, ""); | |
54 | static_assert(!is_constructible<std::pair<int, Poison>&, | |
55 | std::pair<char, Poison>>::value, ""); | |
56 | static_assert(!is_assignable<std::pair<int, Poison>&, | |
57 | std::pair<char, Poison>>::value, ""); | |
58 | static_assert(!is_copy_constructible<std::pair<ThrowingCopy, | |
59 | std::unique_ptr<int>>>::value, | |
60 | ""); | |
61 | static_assert(is_move_constructible<std::pair<ThrowingCopy, | |
62 | std::unique_ptr<int>>>::value, | |
63 | ""); | |
64 | static_assert(!is_nothrow_move_constructible<std::pair<ThrowingCopy, | |
65 | std::unique_ptr<int>>>::value, | |
66 | ""); | |
67 | static_assert(!is_copy_assignable<std::pair<ThrowingCopy, | |
68 | std::unique_ptr<int>>>::value, | |
69 | ""); | |
70 | static_assert(is_move_assignable<std::pair<ThrowingCopy, | |
71 | std::unique_ptr<int>>>::value, | |
72 | ""); | |
73 | static_assert(!is_nothrow_move_assignable<std::pair<ThrowingCopy, | |
74 | std::unique_ptr<int>>>::value, | |
75 | ""); | |
76 | } |