| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // Copyright (C) 2012-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 <type_traits> |
| 21 | #include <initializer_list> |
| 22 | #include <testsuite_tr1.h> |
| 23 | |
| 24 | using namespace __gnu_test::destruct; |
| 25 | |
| 26 | // is_nothrow_destructible: |
| 27 | static_assert(std::is_nothrow_destructible<int>::value, "Error"); |
| 28 | static_assert(std::is_nothrow_destructible<const int>::value, "Error"); |
| 29 | static_assert(std::is_nothrow_destructible<const volatile int>::value, "Error"); |
| 30 | static_assert(std::is_nothrow_destructible<int[12]>::value, "Error"); |
| 31 | static_assert(std::is_nothrow_destructible<const int[12]>::value, "Error"); |
| 32 | static_assert(std::is_nothrow_destructible<const volatile int[12]>::value, "Error"); |
| 33 | static_assert(std::is_nothrow_destructible<decltype(nullptr)>::value, "Error"); |
| 34 | static_assert(std::is_nothrow_destructible<std::initializer_list<int>>::value, "Error"); |
| 35 | static_assert(std::is_nothrow_destructible<std::initializer_list<decltype(nullptr)>>::value, "Error"); |
| 36 | static_assert(std::is_nothrow_destructible<std::initializer_list<TD1>>::value, "Error"); |
| 37 | static_assert(std::is_nothrow_destructible<std::initializer_list<TD2>>::value, "Error"); |
| 38 | static_assert(std::is_nothrow_destructible<E>::value, "Error"); |
| 39 | static_assert(std::is_nothrow_destructible<const E>::value, "Error"); |
| 40 | static_assert(std::is_nothrow_destructible<const volatile E>::value, "Error"); |
| 41 | static_assert(std::is_nothrow_destructible<NTD1>::value, "Error"); |
| 42 | static_assert(std::is_nothrow_destructible<NTD2>::value, "Error"); |
| 43 | static_assert(std::is_nothrow_destructible<NTD3>::value, "Error"); |
| 44 | static_assert(std::is_nothrow_destructible<Aggr>::value, "Error"); |
| 45 | static_assert(std::is_nothrow_destructible<U1>::value, "Error"); |
| 46 | static_assert(std::is_nothrow_destructible<void(*)()>::value, "Error"); |
| 47 | static_assert(std::is_nothrow_destructible<void*>::value, "Error"); |
| 48 | static_assert(std::is_nothrow_destructible<int&>::value, "Error"); |
| 49 | static_assert(std::is_nothrow_destructible<TD1&>::value, "Error"); |
| 50 | static_assert(std::is_nothrow_destructible<TD2&>::value, "Error"); |
| 51 | static_assert(std::is_nothrow_destructible<TD1*>::value, "Error"); |
| 52 | static_assert(std::is_nothrow_destructible<TD2*>::value, "Error"); |
| 53 | static_assert(std::is_nothrow_destructible<void(&)()>::value, "Error"); |
| 54 | static_assert(std::is_nothrow_destructible<void(&&)()>::value, "Error"); |
| 55 | static_assert(std::is_nothrow_destructible<En>::value, "Error"); |
| 56 | static_assert(std::is_nothrow_destructible<En*>::value, "Error"); |
| 57 | static_assert(std::is_nothrow_destructible<En&>::value, "Error"); |
| 58 | static_assert(std::is_nothrow_destructible<En2>::value, "Error"); |
| 59 | static_assert(std::is_nothrow_destructible<En2*>::value, "Error"); |
| 60 | static_assert(std::is_nothrow_destructible<En2&>::value, "Error"); |
| 61 | static_assert(std::is_nothrow_destructible<TD1(&)(Aggr2, TD2)>::value, "Error"); |
| 62 | static_assert(std::is_nothrow_destructible<TD1(*)(Aggr2, TD2)>::value, "Error"); |
| 63 | static_assert(std::is_nothrow_destructible<Abstract1>::value, "Error"); |
| 64 | static_assert(std::is_nothrow_destructible<Der>::value, "Error"); |
| 65 | static_assert(std::is_nothrow_destructible<Del&>::value, "Error"); |
| 66 | static_assert(std::is_nothrow_destructible<Del2&>::value, "Error"); |
| 67 | static_assert(std::is_nothrow_destructible<Del3&>::value, "Error"); |
| 68 | static_assert(std::is_nothrow_destructible<Del(&)[1]>::value, "Error"); |
| 69 | static_assert(std::is_nothrow_destructible<Del2(&)[2]>::value, "Error"); |
| 70 | static_assert(std::is_nothrow_destructible<Del3(&)[3]>::value, "Error"); |
| 71 | static_assert(std::is_nothrow_destructible<Del&&>::value, "Error"); |
| 72 | static_assert(std::is_nothrow_destructible<Del2&&>::value, "Error"); |
| 73 | static_assert(std::is_nothrow_destructible<Del3&>::value, "Error"); |
| 74 | static_assert(std::is_nothrow_destructible<Del(&&)[1]>::value, "Error"); |
| 75 | static_assert(std::is_nothrow_destructible<Del2(&&)[2]>::value, "Error"); |
| 76 | static_assert(std::is_nothrow_destructible<Del3(&&)[3]>::value, "Error"); |
| 77 | static_assert(std::is_nothrow_destructible<Ut&>::value, "Error"); |
| 78 | static_assert(std::is_nothrow_destructible<Ut&&>::value, "Error"); |
| 79 | static_assert(std::is_nothrow_destructible<Ut*>::value, "Error"); |
| 80 | static_assert(std::is_nothrow_destructible<Abstract2&>::value, "Error"); |
| 81 | static_assert(std::is_nothrow_destructible<Abstract3&>::value, "Error"); |
| 82 | static_assert(std::is_nothrow_destructible<Abstract2*>::value, "Error"); |
| 83 | static_assert(std::is_nothrow_destructible<Abstract3*>::value, "Error"); |
| 84 | |
| 85 | static_assert(!std::is_nothrow_destructible<void>::value, "Error"); |
| 86 | static_assert(!std::is_nothrow_destructible<const void>::value, "Error"); |
| 87 | static_assert(!std::is_nothrow_destructible<void()>::value, "Error"); |
| 88 | static_assert(!std::is_nothrow_destructible<void() const>::value, "Error"); |
| 89 | static_assert(!std::is_nothrow_destructible<TD1(Aggr2, TD2)>::value, "Error"); |
| 90 | static_assert(!std::is_nothrow_destructible<int[]>::value, "Error"); |
| 91 | static_assert(!std::is_nothrow_destructible<const int[]>::value, "Error"); |
| 92 | static_assert(!std::is_nothrow_destructible<const volatile int[]>::value, "Error"); |
| 93 | static_assert(!std::is_nothrow_destructible<int[][123]>::value, "Error"); |
| 94 | static_assert(!std::is_nothrow_destructible<TD1>::value, "Error"); |
| 95 | static_assert(!std::is_nothrow_destructible<TD2>::value, "Error"); |
| 96 | static_assert(!std::is_nothrow_destructible<Aggr2>::value, "Error"); |
| 97 | static_assert(!std::is_nothrow_destructible<Aggr2[1]>::value, "Error"); |
| 98 | static_assert(!std::is_nothrow_destructible<TD1[1][2]>::value, "Error"); |
| 99 | static_assert(!std::is_nothrow_destructible<Ut>::value, "Error"); |
| 100 | static_assert(!std::is_nothrow_destructible<Ut[3]>::value, "Error"); |
| 101 | static_assert(!std::is_nothrow_destructible<AbstractDelDtor>::value, "Error"); |
| 102 | static_assert(!std::is_nothrow_destructible<Abstract2>::value, "Error"); |
| 103 | static_assert(!std::is_nothrow_destructible<Abstract3>::value, "Error"); |
| 104 | static_assert(!std::is_nothrow_destructible<Der2>::value, "Error"); |
| 105 | static_assert(!std::is_nothrow_destructible<Del>::value, "Error"); |
| 106 | static_assert(!std::is_nothrow_destructible<Del2>::value, "Error"); |
| 107 | static_assert(!std::is_nothrow_destructible<Del3>::value, "Error"); |
| 108 | static_assert(!std::is_nothrow_destructible<Del[1]>::value, "Error"); |
| 109 | static_assert(!std::is_nothrow_destructible<Del2[2]>::value, "Error"); |
| 110 | static_assert(!std::is_nothrow_destructible<Del3[3]>::value, "Error"); |
| 111 |