| 1 | // { dg-do compile { target c++11 } } |
| 2 | |
| 3 | // Copyright (C) 2019-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 | |
| 22 | |
| 23 | struct incomplete_type; |
| 24 | class incomplete_type2; |
| 25 | union incomplete_union; |
| 26 | enum class incomplete_enum: int; |
| 27 | enum incomplete_enum2: int; |
| 28 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_type>{}), ""); |
| 29 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_type2>{}), ""); |
| 30 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_union>{}), ""); |
| 31 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum>{}), ""); |
| 32 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum2>{}), ""); |
| 33 | |
| 34 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_type[42]>{}), ""); |
| 35 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_type2[42]>{}), ""); |
| 36 | static_assert(!std::__is_complete_or_unbounded(std::__type_identity<incomplete_union[42]>{}), ""); |
| 37 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum[42]>{}), ""); |
| 38 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum2[42]>{}), ""); |
| 39 | |
| 40 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_type[]>{}), ""); |
| 41 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_type2[]>{}), ""); |
| 42 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_union[]>{}), ""); |
| 43 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum[]>{}), ""); |
| 44 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_enum2[]>{}), ""); |
| 45 | |
| 46 | |
| 47 | struct complete_type{ ~complete_type() = delete; }; |
| 48 | class complete_type2{ int i; }; |
| 49 | union complete_union{}; |
| 50 | enum class complete_enum: int {}; |
| 51 | enum complete_enum2: int {}; |
| 52 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type>{}), ""); |
| 53 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type2>{}), ""); |
| 54 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_union>{}), ""); |
| 55 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum>{}), ""); |
| 56 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum2>{}), ""); |
| 57 | |
| 58 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type[42]>{}), ""); |
| 59 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type2[42]>{}), ""); |
| 60 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_union[42]>{}), ""); |
| 61 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum[42]>{}), ""); |
| 62 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum2[42]>{}), ""); |
| 63 | |
| 64 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type[]>{}), ""); |
| 65 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type2[]>{}), ""); |
| 66 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_union[]>{}), ""); |
| 67 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum[]>{}), ""); |
| 68 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_enum2[]>{}), ""); |
| 69 | |
| 70 | |
| 71 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_type>{}), ""); |
| 72 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_type2>{}), ""); |
| 73 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_union>{}), ""); |
| 74 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_enum>{}), ""); |
| 75 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_enum2>{}), ""); |
| 76 | |
| 77 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_type*>{}), ""); |
| 78 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type*>{}), ""); |
| 79 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const incomplete_type*>{}), ""); |
| 80 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const complete_type*>{}), ""); |
| 81 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_type&>{}), ""); |
| 82 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type&>{}), ""); |
| 83 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<incomplete_type&&>{}), ""); |
| 84 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<complete_type&&>{}), ""); |
| 85 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<int complete_type::*>{}), ""); |
| 86 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<int (complete_type::*)(int)>{}), ""); |
| 87 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<int incomplete_type::*>{}), ""); |
| 88 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<int (incomplete_type::*)(int)>{}), ""); |
| 89 | |
| 90 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(*)() noexcept>{}), ""); |
| 91 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(...) noexcept>{}), ""); |
| 92 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(&)(int)>{}), ""); |
| 93 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(*)()>{}), ""); |
| 94 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(incomplete_type)>{}), ""); |
| 95 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void(&)()>{}), ""); |
| 96 | |
| 97 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<std::nullptr_t>{}), ""); |
| 98 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void>{}), ""); |
| 99 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<void*>{}), ""); |
| 100 | static_assert(std::__is_complete_or_unbounded(std::__type_identity<const void* const>{}), ""); |