| 1 |
// { dg-do compile { target c++11 } } |
| 2 |
|
| 3 |
// Copyright (C) 2011-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::construct; |
| 25 |
|
| 26 |
static_assert(std::is_default_constructible<int>::value, "Error"); |
| 27 |
static_assert(std::is_default_constructible<int const>::value, "Error"); |
| 28 |
static_assert(std::is_default_constructible<int const volatile>::value, |
| 29 |
"Error"); |
| 30 |
static_assert(std::is_default_constructible<int*>::value, "Error"); |
| 31 |
static_assert(std::is_default_constructible<void*>::value, "Error"); |
| 32 |
static_assert(std::is_default_constructible<void* const>::value, "Error"); |
| 33 |
static_assert(std::is_default_constructible<int B::*>::value, "Error"); |
| 34 |
static_assert(std::is_default_constructible<void(*)()>::value, "Error"); |
| 35 |
static_assert(std::is_default_constructible<std::nullptr_t>::value, "Error"); |
| 36 |
static_assert(std::is_default_constructible<std::nullptr_t const>::value, |
| 37 |
"Error"); |
| 38 |
static_assert(std::is_default_constructible<Empty>::value, "Error"); |
| 39 |
static_assert(std::is_default_constructible<Empty const>::value, "Error"); |
| 40 |
static_assert(std::is_default_constructible<FromArgs<>>::value, "Error"); |
| 41 |
static_assert(std::is_default_constructible<FromArgs<> const>::value, "Error"); |
| 42 |
static_assert(std::is_default_constructible<nAny>::value, "Error"); |
| 43 |
static_assert(std::is_default_constructible<nAny const>::value, "Error"); |
| 44 |
static_assert(std::is_default_constructible<Ellipsis>::value, "Error"); |
| 45 |
static_assert(std::is_default_constructible<Ellipsis const>::value, "Error"); |
| 46 |
static_assert(std::is_default_constructible<U>::value, "Error"); |
| 47 |
static_assert(std::is_default_constructible<U const>::value, "Error"); |
| 48 |
static_assert(std::is_default_constructible<E>::value, "Error"); |
| 49 |
static_assert(std::is_default_constructible<E const>::value, "Error"); |
| 50 |
static_assert(std::is_default_constructible<SE>::value, "Error"); |
| 51 |
static_assert(std::is_default_constructible<SE const>::value, "Error"); |
| 52 |
static_assert(std::is_default_constructible<OpE>::value, "Error"); |
| 53 |
static_assert(std::is_default_constructible<OpE const>::value, "Error"); |
| 54 |
static_assert(std::is_default_constructible<OpSE>::value, "Error"); |
| 55 |
static_assert(std::is_default_constructible<OpSE const>::value, "Error"); |
| 56 |
static_assert(std::is_default_constructible<int[1]>::value, "Error"); |
| 57 |
static_assert(std::is_default_constructible<const int[1]>::value, "Error"); |
| 58 |
static_assert(std::is_default_constructible<int[1][2]>::value, "Error"); |
| 59 |
static_assert(std::is_default_constructible<const int[1][2]>::value, "Error"); |
| 60 |
static_assert(std::is_default_constructible<FromArgs<>[1]>::value, "Error"); |
| 61 |
static_assert(std::is_default_constructible<const FromArgs<>[1]>::value, |
| 62 |
"Error"); |
| 63 |
static_assert(std::is_default_constructible<U[1]>::value, "Error"); |
| 64 |
static_assert(std::is_default_constructible<const U[1]>::value, "Error"); |
| 65 |
static_assert(std::is_default_constructible<Empty[1]>::value, "Error"); |
| 66 |
static_assert(std::is_default_constructible<const Empty[1]>::value, "Error"); |
| 67 |
static_assert(std::is_default_constructible<Ellipsis[1]>::value, "Error"); |
| 68 |
static_assert(std::is_default_constructible<const Ellipsis[1]>::value, "Error"); |
| 69 |
static_assert(std::is_default_constructible<std::nullptr_t[1]>::value, "Error"); |
| 70 |
static_assert(std::is_default_constructible<const std::nullptr_t[1]>::value, |
| 71 |
"Error"); |
| 72 |
static_assert(std::is_default_constructible<nAny[1]>::value, "Error"); |
| 73 |
static_assert(std::is_default_constructible<const nAny[1]>::value, "Error"); |
| 74 |
static_assert(std::is_default_constructible<E[1]>::value, "Error"); |
| 75 |
static_assert(std::is_default_constructible<const E[1]>::value, "Error"); |
| 76 |
static_assert(std::is_default_constructible<SE[1]>::value, "Error"); |
| 77 |
static_assert(std::is_default_constructible<const SE[1]>::value, "Error"); |
| 78 |
static_assert(std::is_default_constructible<OpE[1]>::value, "Error"); |
| 79 |
static_assert(std::is_default_constructible<const OpE[1]>::value, "Error"); |
| 80 |
static_assert(std::is_default_constructible<OpSE[1]>::value, "Error"); |
| 81 |
static_assert(std::is_default_constructible<const OpSE[1]>::value, "Error"); |
| 82 |
static_assert(std::is_default_constructible<int*[1]>::value, "Error"); |
| 83 |
static_assert(std::is_default_constructible<int* const[1]>::value, "Error"); |
| 84 |
static_assert(std::is_default_constructible<int B::*[1]>::value, "Error"); |
| 85 |
static_assert(std::is_default_constructible<int B::* const[1]>::value, "Error"); |
| 86 |
static_assert(std::is_default_constructible<std::initializer_list<int>>::value, |
| 87 |
"Error"); |
| 88 |
static_assert(std::is_default_constructible<const |
| 89 |
std::initializer_list<int>>::value, "Error"); |
| 90 |
static_assert(std::is_default_constructible< |
| 91 |
std::initializer_list<int>[1]>::value, "Error"); |
| 92 |
static_assert(std::is_default_constructible<const |
| 93 |
std::initializer_list<int>[1]>::value, "Error"); |
| 94 |
|
| 95 |
static_assert(std::is_default_constructible |
| 96 |
<__gnu_test::NoexceptDefaultClass>::value, "Error"); |
| 97 |
static_assert(std::is_default_constructible |
| 98 |
<__gnu_test::ThrowDefaultClass>::value, "Error"); |
| 99 |
static_assert(std::is_default_constructible |
| 100 |
<__gnu_test::ExceptDefaultClass>::value, "Error"); |
| 101 |
|
| 102 |
static_assert(!std::is_default_constructible<void>::value, "Error"); |
| 103 |
static_assert(!std::is_default_constructible<const void>::value, "Error"); |
| 104 |
static_assert(!std::is_default_constructible<Abstract>::value, "Error"); |
| 105 |
static_assert(!std::is_default_constructible<const Abstract>::value, "Error"); |
| 106 |
static_assert(!std::is_default_constructible<Any>::value, "Error"); |
| 107 |
static_assert(!std::is_default_constructible<const Any>::value, "Error"); |
| 108 |
static_assert(!std::is_default_constructible<FromArgs<int>>::value, "Error"); |
| 109 |
static_assert(!std::is_default_constructible<const FromArgs<int>>::value, |
| 110 |
"Error"); |
| 111 |
static_assert(!std::is_default_constructible<int&>::value, "Error"); |
| 112 |
static_assert(!std::is_default_constructible<int&&>::value, "Error"); |
| 113 |
static_assert(!std::is_default_constructible<void()>::value, "Error"); |
| 114 |
static_assert(!std::is_default_constructible<void() const volatile>::value, |
| 115 |
"Error"); |
| 116 |
static_assert(!std::is_default_constructible<void(&)()>::value, "Error"); |
| 117 |
static_assert(!std::is_default_constructible<int(&)[1]>::value, "Error"); |
| 118 |
static_assert(!std::is_default_constructible<int(&)[]>::value, "Error"); |
| 119 |
static_assert(!std::is_default_constructible<int[]>::value, "Error"); |
| 120 |
static_assert(!std::is_default_constructible<const int[]>::value, "Error"); |
| 121 |
static_assert(!std::is_default_constructible<int[][1][2]>::value, "Error"); |
| 122 |
static_assert(!std::is_default_constructible<const int[][1][2]>::value, |
| 123 |
"Error"); |
| 124 |
static_assert(!std::is_default_constructible<Any[1]>::value, "Error"); |
| 125 |
static_assert(!std::is_default_constructible<const Any[1]>::value, "Error"); |
| 126 |
static_assert(!std::is_default_constructible<FromArgs<int>[1]>::value, "Error"); |
| 127 |
static_assert(!std::is_default_constructible<const FromArgs<int>[1]>::value, |
| 128 |
"Error"); |
| 129 |
static_assert(!std::is_default_constructible< |
| 130 |
FromArgs<std::initializer_list<int>>>::value, "Error"); |
| 131 |
static_assert(!std::is_default_constructible<const |
| 132 |
FromArgs<std::initializer_list<int>>>::value, "Error"); |
| 133 |
static_assert(!std::is_default_constructible<const |
| 134 |
FromArgs<const std::initializer_list<int>>>::value, "Error"); |
| 135 |
static_assert(!std::is_default_constructible<DelDef>::value, "Error"); |
| 136 |
static_assert(!std::is_default_constructible<const DelDef>::value, "Error"); |
| 137 |
static_assert(!std::is_default_constructible<DelCopy>::value, "Error"); |
| 138 |
static_assert(!std::is_default_constructible<const DelCopy>::value, "Error"); |
| 139 |
static_assert(!std::is_default_constructible<DelDtor>::value, "Error"); |
| 140 |
static_assert(!std::is_default_constructible<const DelDtor>::value, "Error"); |
| 141 |
|
| 142 |
static_assert(!std::is_default_constructible<int[]>::value, "PR c++/90532"); |
| 143 |
static_assert(!std::is_default_constructible<Empty[]>::value, "PR c++/90532"); |
| 144 |
static_assert(!std::is_default_constructible<B[]>::value, "PR c++/90532"); |
| 145 |
static_assert(!std::is_default_constructible<D[]>::value, "PR c++/90532"); |
| 146 |
static_assert(!std::is_default_constructible<U[]>::value, "PR c++/90532"); |
| 147 |
static_assert(!std::is_default_constructible<Ukn[]>::value, "PR c++/90532"); |
| 148 |
static_assert(!std::is_default_constructible<Ellipsis[]>::value, "PR c++/90532"); |
| 149 |
static_assert(!std::is_default_constructible<Any[]>::value, "PR c++/90532"); |
| 150 |
static_assert(!std::is_default_constructible<nAny[]>::value, "PR c++/90532"); |