| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // Copyright (C) 2007-2025 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 <new> |
| 21 | |
| 22 | namespace std { |
| 23 | class bad_alloc; |
| 24 | class bad_array_new_length; |
| 25 | struct nothrow_t; |
| 26 | extern const nothrow_t nothrow; |
| 27 | typedef void (*new_handler)(); |
| 28 | new_handler get_new_handler() noexcept; |
| 29 | new_handler set_new_handler(new_handler new_p) noexcept; |
| 30 | |
| 31 | #if __cplusplus > 201402L |
| 32 | enum class align_val_t : size_t; |
| 33 | // _GLIBCXX17_INLINE constexpr size_t |
| 34 | // hardware_destructive_interference_size; |
| 35 | // _GLIBCXX17_INLINE constexpr size_t |
| 36 | // hardware_constructive_interference_size; |
| 37 | #endif |
| 38 | } |
| 39 | |
| 40 | void* operator new(std::size_t size); |
| 41 | void* operator new(std::size_t size, const std::nothrow_t&) noexcept; |
| 42 | void operator delete(void* ptr) throw(); |
| 43 | void operator delete(void* ptr, const std::nothrow_t&) throw(); |
| 44 | void* operator new[](std::size_t size); |
| 45 | void* operator new[](std::size_t size, const std::nothrow_t&) throw(); |
| 46 | void operator delete[](void* ptr) throw(); |
| 47 | void operator delete[](void* ptr, const std::nothrow_t&) throw(); |
| 48 | |
| 49 | #if __cplusplus > 202302L |
| 50 | # define CXX26_CONSTEXPR constexpr |
| 51 | #else |
| 52 | # define CXX26_CONSTEXPR |
| 53 | #endif |
| 54 | CXX26_CONSTEXPR void* operator new (std::size_t size, void* ptr) throw(); |
| 55 | CXX26_CONSTEXPR void* operator new[](std::size_t size, void* ptr) throw(); |
| 56 | void operator delete (void* ptr, void*) throw(); |
| 57 | void operator delete[](void* ptr, void*) throw(); |
| 58 | |
| 59 | #if __cplusplus >= 201402L |
| 60 | // C++14 sized deallocation functions |
| 61 | void operator delete(void* ptr, std::size_t size) noexcept; |
| 62 | void operator delete(void* ptr, std::size_t size, |
| 63 | const std::nothrow_t&) noexcept; |
| 64 | void operator delete[](void* ptr, std::size_t size) noexcept; |
| 65 | void operator delete[](void* ptr, std::size_t size, |
| 66 | const std::nothrow_t&) noexcept; |
| 67 | #endif |
| 68 | |
| 69 | #if __cplusplus > 201402L |
| 70 | // C++17 (de)allocation functions for types with new-extended alignment |
| 71 | void* operator new(std::size_t, std::align_val_t); |
| 72 | void* operator new(std::size_t, std::align_val_t, |
| 73 | const std::nothrow_t&) noexcept; |
| 74 | void operator delete(void*, std::align_val_t) noexcept; |
| 75 | void operator delete(void*, std::size_t, std::align_val_t) noexcept; |
| 76 | void operator delete(void*, std::align_val_t, |
| 77 | const std::nothrow_t&) noexcept; |
| 78 | |
| 79 | void* operator new[](std::size_t, std::align_val_t); |
| 80 | void* operator new[](std::size_t, std::align_val_t, |
| 81 | const std::nothrow_t&) noexcept; |
| 82 | void operator delete[](void*, std::align_val_t) noexcept; |
| 83 | void operator delete[](void*, std::size_t, std::align_val_t) noexcept; |
| 84 | void operator delete[](void*, std::align_val_t, |
| 85 | const std::nothrow_t&) noexcept; |
| 86 | #endif |