]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/any/requirements.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / any / requirements.cc
CommitLineData
6458742a 1// { dg-do compile { target c++17 } }
25a69162 2
a945c346 3// Copyright (C) 2016-2024 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
25using std::any;
26using std::unique_ptr;
27
28static_assert(std::is_assignable<any&, int>::value);
29static_assert(!std::is_assignable<any&, unique_ptr<int>>::value);
30static_assert(std::is_constructible<any, int>::value);
31static_assert(!std::is_constructible<any, unique_ptr<int>>::value);
1ec0f763
VV
32static_assert(!std::is_assignable<any&, const unique_ptr<int>&>::value);
33static_assert(!std::is_constructible<any&, const unique_ptr<int>&>::value);
34static_assert(!std::is_assignable<any&, unique_ptr<int>&>::value);
35static_assert(!std::is_constructible<any&, unique_ptr<int>&>::value);
5c578ae4
VV
36
37struct NoDefaultCtor
38{
39 NoDefaultCtor() = delete;
40};
41
42static_assert(!std::is_constructible<any,
43 std::in_place_type_t<NoDefaultCtor>>::value);
627a2f59
VV
44
45static_assert(!std::is_constructible<any,
46 std::in_place_type_t<NoDefaultCtor>&>::value);
47
48static_assert(!std::is_constructible<any,
49 std::in_place_type_t<NoDefaultCtor>&&>::value);
50
51static_assert(!std::is_constructible<any,
52 const std::in_place_type_t<NoDefaultCtor>&>::value);
53
54static_assert(!std::is_constructible<any,
55 const std::in_place_type_t<NoDefaultCtor>&&>::value);