]>
Commit | Line | Data |
---|---|---|
6458742a | 1 | // { dg-do compile { target c++17 } } |
25a69162 | 2 | |
83ffe9cd | 3 | // Copyright (C) 2016-2023 Free Software Foundation, Inc. |
25a69162 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 | ||
c7cbb4da | 16 | // You should have received a copy of the GNU General Public License along |
25a69162 VV |
17 | // with this library; see the file COPYING3. If not see |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | #include <any> | |
21 | #include <testsuite_hooks.h> | |
22 | ||
23 | #include <memory> | |
24 | ||
25 | using std::any; | |
26 | using std::unique_ptr; | |
27 | ||
28 | static_assert(std::is_assignable<any&, int>::value); | |
29 | static_assert(!std::is_assignable<any&, unique_ptr<int>>::value); | |
30 | static_assert(std::is_constructible<any, int>::value); | |
31 | static_assert(!std::is_constructible<any, unique_ptr<int>>::value); | |
1ec0f763 VV |
32 | static_assert(!std::is_assignable<any&, const unique_ptr<int>&>::value); |
33 | static_assert(!std::is_constructible<any&, const unique_ptr<int>&>::value); | |
34 | static_assert(!std::is_assignable<any&, unique_ptr<int>&>::value); | |
35 | static_assert(!std::is_constructible<any&, unique_ptr<int>&>::value); | |
5c578ae4 VV |
36 | |
37 | struct NoDefaultCtor | |
38 | { | |
39 | NoDefaultCtor() = delete; | |
40 | }; | |
41 | ||
42 | static_assert(!std::is_constructible<any, | |
43 | std::in_place_type_t<NoDefaultCtor>>::value); | |
627a2f59 VV |
44 | |
45 | static_assert(!std::is_constructible<any, | |
46 | std::in_place_type_t<NoDefaultCtor>&>::value); | |
47 | ||
48 | static_assert(!std::is_constructible<any, | |
49 | std::in_place_type_t<NoDefaultCtor>&&>::value); | |
50 | ||
51 | static_assert(!std::is_constructible<any, | |
52 | const std::in_place_type_t<NoDefaultCtor>&>::value); | |
53 | ||
54 | static_assert(!std::is_constructible<any, | |
55 | const std::in_place_type_t<NoDefaultCtor>&&>::value); |