]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/memory_resource/1.cc
Daily bump.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / memory_resource / 1.cc
1 // { dg-do compile { target c++17 } }
2
3 // Copyright (C) 2018-2024 Free Software Foundation, Inc.
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
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/>.
19
20 #include <memory_resource>
21
22 static_assert(std::is_abstract_v<std::pmr::memory_resource>);
23 static_assert(std::is_polymorphic_v<std::pmr::memory_resource>);
24 static_assert(!std::is_final_v<std::pmr::memory_resource>);
25
26 struct R0 : std::pmr::memory_resource { };
27 static_assert(std::is_abstract_v<R0>);
28
29 struct R1 : R0 {
30 void* do_allocate(std::size_t, std::size_t) override;
31 };
32 static_assert(std::is_abstract_v<R1>);
33
34 struct R2 : R1 {
35 void do_deallocate(void*, std::size_t, std::size_t) override;
36 };
37 static_assert(std::is_abstract_v<R2>);
38
39 struct R3 : R2 {
40 bool do_is_equal(const std::pmr::memory_resource&) const noexcept override;
41 };
42 static_assert(!std::is_abstract_v<R3>);
43 static_assert(std::is_default_constructible_v<R3>);
44 static_assert(std::is_copy_constructible_v<R3>);
45 static_assert(std::is_copy_assignable_v<R3>);
46 static_assert(std::is_destructible_v<R3>);