]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/is_destructible/value.cc
1 // { dg-do compile { target c++11 } }
3 // Copyright (C) 2011-2024 Free Software Foundation, Inc.
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)
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.
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/>.
20 #include <type_traits>
21 #include <initializer_list>
22 #include <testsuite_tr1.h>
24 using namespace __gnu_test::destruct
;
26 static_assert(std::is_destructible
<int>::value
, "Error");
27 static_assert(std::is_destructible
<const int>::value
, "Error");
28 static_assert(std::is_destructible
<bool>::value
, "Error");
29 static_assert(std::is_destructible
<const bool>::value
, "Error");
30 static_assert(std::is_destructible
<int*>::value
, "Error");
31 static_assert(std::is_destructible
<void*>::value
, "Error");
32 static_assert(std::is_destructible
<int Der::*>::value
, "Error");
33 static_assert(std::is_destructible
<const int Der::*>::value
, "Error");
34 static_assert(std::is_destructible
<void (Der::*)() const>::value
, "Error");
35 static_assert(std::is_destructible
<void(*)()>::value
, "Error");
36 static_assert(std::is_destructible
<En
>::value
, "Error");
37 static_assert(std::is_destructible
<const En
>::value
, "Error");
38 static_assert(std::is_destructible
<En2
>::value
, "Error");
39 static_assert(std::is_destructible
<const En2
>::value
, "Error");
40 static_assert(std::is_destructible
<OpE
>::value
, "Error");
41 static_assert(std::is_destructible
<const OpE
>::value
, "Error");
42 static_assert(std::is_destructible
<OpSE
>::value
, "Error");
43 static_assert(std::is_destructible
<const OpSE
>::value
, "Error");
44 static_assert(std::is_destructible
<std::nullptr_t
>::value
, "Error");
45 static_assert(std::is_destructible
<const std::nullptr_t
>::value
, "Error");
46 static_assert(std::is_destructible
<Der
>::value
, "Error");
47 static_assert(std::is_destructible
<const Der
>::value
, "Error");
48 static_assert(std::is_destructible
<Aggr
>::value
, "Error");
49 static_assert(std::is_destructible
<const Aggr
>::value
, "Error");
50 static_assert(std::is_destructible
<E
>::value
, "Error");
51 static_assert(std::is_destructible
<const E
>::value
, "Error");
52 static_assert(std::is_destructible
<U1
>::value
, "Error");
53 static_assert(std::is_destructible
<const U1
>::value
, "Error");
54 static_assert(std::is_destructible
<Abstract1
>::value
, "Error");
55 static_assert(std::is_destructible
<const Abstract1
>::value
, "Error");
56 static_assert(std::is_destructible
<int[1]>::value
, "Error");
57 static_assert(std::is_destructible
<const int[1]>::value
, "Error");
58 static_assert(std::is_destructible
<int[1][2]>::value
, "Error");
59 static_assert(std::is_destructible
<const int[1][2]>::value
, "Error");
60 static_assert(std::is_destructible
<int&>::value
, "Error");
61 static_assert(std::is_destructible
<int&&>::value
, "Error");
62 static_assert(std::is_destructible
<int(&)[1]>::value
, "Error");
63 static_assert(std::is_destructible
<const int(&)[1]>::value
, "Error");
64 static_assert(std::is_destructible
<void(&)()>::value
, "Error");
65 static_assert(std::is_destructible
<Ellipsis
>::value
, "Error");
66 static_assert(std::is_destructible
<const Ellipsis
>::value
, "Error");
67 static_assert(std::is_destructible
<Abstract2
>::value
, "Error");
68 static_assert(std::is_destructible
<const Abstract2
>::value
, "Error");
69 static_assert(std::is_destructible
<Aggr2
>::value
, "Error");
70 static_assert(std::is_destructible
<const Aggr2
>::value
, "Error");
71 static_assert(std::is_destructible
<DelDef
>::value
, "Error");
72 static_assert(std::is_destructible
<const DelDef
>::value
, "Error");
73 static_assert(std::is_destructible
<DelCopy
>::value
, "Error");
74 static_assert(std::is_destructible
<const DelCopy
>::value
, "Error");
75 static_assert(std::is_destructible
<DelEllipsis
>::value
, "Error");
76 static_assert(std::is_destructible
<const DelEllipsis
>::value
, "Error");
77 static_assert(std::is_destructible
<std::initializer_list
<int>>::value
,
79 static_assert(std::is_destructible
<const std::initializer_list
<int>>::value
,
81 static_assert(std::is_destructible
<std::initializer_list
<Del
>>::value
,
84 static_assert(!std::is_destructible
<void>::value
, "Error");
85 static_assert(!std::is_destructible
<const void>::value
, "Error");
86 static_assert(!std::is_destructible
<void()>::value
, "Error");
87 static_assert(!std::is_destructible
<void() const>::value
, "Error");
88 static_assert(!std::is_destructible
<int[]>::value
, "Error");
89 static_assert(!std::is_destructible
<const int[]>::value
, "Error");
90 static_assert(!std::is_destructible
<Del
>::value
, "Error");
91 static_assert(!std::is_destructible
<const Del
>::value
, "Error");
92 static_assert(!std::is_destructible
<AbstractDelDtor
>::value
, "Error");
93 static_assert(!std::is_destructible
<const AbstractDelDtor
>::value
, "Error");
94 static_assert(!std::is_destructible
<int[][1]>::value
, "Error");
95 static_assert(!std::is_destructible
<const int[][1]>::value
, "Error");
96 static_assert(!std::is_destructible
<Del
[1]>::value
, "Error");
97 static_assert(!std::is_destructible
<const Del
[1]>::value
, "Error");
98 static_assert(!std::is_destructible
<Del
[]>::value
, "Error");
99 static_assert(!std::is_destructible
<const Del
[]>::value
, "Error");
101 // Deleted members in unions with non-trivial members:
102 static_assert(!std::is_destructible
<NontrivialUnion
>::value
, "Error");
105 static_assert(std::is_destructible
<UnusualCopy
>::value
, "Error");