]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/any/requirements.cc
1 // { dg-do compile { target c++17 } }
3 // Copyright (C) 2016-2022 Free Software Foundation, Inc.
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)
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.
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/>.
21 #include <testsuite_hooks.h>
26 using std::unique_ptr
;
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
);
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
);
39 NoDefaultCtor() = delete;
42 static_assert(!std::is_constructible
<any
,
43 std::in_place_type_t
<NoDefaultCtor
>>::value
);
45 static_assert(!std::is_constructible
<any
,
46 std::in_place_type_t
<NoDefaultCtor
>&>::value
);
48 static_assert(!std::is_constructible
<any
,
49 std::in_place_type_t
<NoDefaultCtor
>&&>::value
);
51 static_assert(!std::is_constructible
<any
,
52 const std::in_place_type_t
<NoDefaultCtor
>&>::value
);
54 static_assert(!std::is_constructible
<any
,
55 const std::in_place_type_t
<NoDefaultCtor
>&&>::value
);