]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs_c++20.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / allocator / requirements / typedefs_c++20.cc
CommitLineData
8d9254fc 1// Copyright (C) 2019-2020 Free Software Foundation, Inc.
2cae56bd
JW
2//
3// This file is part of the GNU ISO C++ Library. This library is free
4// software; you can redistribute it and/or modify it under the
5// terms of the GNU General Public License as published by the
6// Free Software Foundation; either version 3, or (at your option)
7// any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13
14// You should have received a copy of the GNU General Public License along
15// with this library; see the file COPYING3. If not see
16// <http://www.gnu.org/licenses/>.
17
18// { dg-options "-std=gnu++2a" }
19// { dg-do compile { target c++2a } }
20
21#include <memory>
22
23template<typename Alloc>
24 concept has_pointer = requires { typename Alloc::pointer; };
25
26template<typename Alloc>
27 concept has_const_pointer = requires { typename Alloc::const_pointer; };
28
29template<typename Alloc>
30 concept has_reference = requires { typename Alloc::reference; };
31
32template<typename Alloc>
33 concept has_const_reference = requires { typename Alloc::const_reference; };
34
35template<typename Alloc>
36 concept has_rebind = requires { typename Alloc::template rebind<long>; };
37
38template<typename Alloc>
39 concept has_construct = requires(Alloc& a, int* p) { a.construct(p); };
40
41template<typename Alloc>
42 concept has_destroy = requires(Alloc& a, int* p) { a.destroy(p); };
43
44template<typename Alloc>
45 concept has_max_size = requires(Alloc& a) { a.max_size(); };
46
47using A = std::allocator<int>;
48
49static_assert( !has_pointer<A> );
50static_assert( !has_const_pointer<A> );
51static_assert( !has_reference<A> );
52static_assert( !has_const_reference<A> );
53static_assert( !has_rebind<A> );
54static_assert( !has_construct<A> );
55static_assert( !has_destroy<A> );
56static_assert( !has_max_size<A> );
75c6a925
JW
57
58using V = std::allocator<void>;
59
60static_assert( !has_pointer<V> );
61static_assert( !has_const_pointer<V> );
62static_assert( !has_reference<V> );
63static_assert( !has_const_reference<V> );
64static_assert( !has_rebind<V> );
65static_assert( !has_construct<V> );
66static_assert( !has_destroy<V> );
67static_assert( !has_max_size<V> );