]>
Commit | Line | Data |
---|---|---|
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 | ||
23 | template<typename Alloc> | |
24 | concept has_pointer = requires { typename Alloc::pointer; }; | |
25 | ||
26 | template<typename Alloc> | |
27 | concept has_const_pointer = requires { typename Alloc::const_pointer; }; | |
28 | ||
29 | template<typename Alloc> | |
30 | concept has_reference = requires { typename Alloc::reference; }; | |
31 | ||
32 | template<typename Alloc> | |
33 | concept has_const_reference = requires { typename Alloc::const_reference; }; | |
34 | ||
35 | template<typename Alloc> | |
36 | concept has_rebind = requires { typename Alloc::template rebind<long>; }; | |
37 | ||
38 | template<typename Alloc> | |
39 | concept has_construct = requires(Alloc& a, int* p) { a.construct(p); }; | |
40 | ||
41 | template<typename Alloc> | |
42 | concept has_destroy = requires(Alloc& a, int* p) { a.destroy(p); }; | |
43 | ||
44 | template<typename Alloc> | |
45 | concept has_max_size = requires(Alloc& a) { a.max_size(); }; | |
46 | ||
47 | using A = std::allocator<int>; | |
48 | ||
49 | static_assert( !has_pointer<A> ); | |
50 | static_assert( !has_const_pointer<A> ); | |
51 | static_assert( !has_reference<A> ); | |
52 | static_assert( !has_const_reference<A> ); | |
53 | static_assert( !has_rebind<A> ); | |
54 | static_assert( !has_construct<A> ); | |
55 | static_assert( !has_destroy<A> ); | |
56 | static_assert( !has_max_size<A> ); | |
75c6a925 JW |
57 | |
58 | using V = std::allocator<void>; | |
59 | ||
60 | static_assert( !has_pointer<V> ); | |
61 | static_assert( !has_const_pointer<V> ); | |
62 | static_assert( !has_reference<V> ); | |
63 | static_assert( !has_const_reference<V> ); | |
64 | static_assert( !has_rebind<V> ); | |
65 | static_assert( !has_construct<V> ); | |
66 | static_assert( !has_destroy<V> ); | |
67 | static_assert( !has_max_size<V> ); |