[rtsan] Add fork/execve interceptors (#117198)
[llvm-project.git] / libcxx / test / std / concepts / concepts.object / regular.compile.pass.cpp
blobab5472f6c391dc066287f73c9a23b7e32fb7f858
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // template<class T>
12 // concept regular = see below;
14 #include <concepts>
16 #include <deque>
17 #include <forward_list>
18 #include <list>
19 #include <map>
20 #include <memory>
21 #include <optional>
22 #include <stdexcept>
23 #include <tuple>
24 #include <unordered_map>
25 #include <vector>
27 #include "type_classification/moveconstructible.h"
28 #include "type_classification/semiregular.h"
30 static_assert(std::regular<int>);
31 static_assert(std::regular<float>);
32 static_assert(std::regular<double>);
33 static_assert(std::regular<long double>);
34 static_assert(std::regular<int volatile>);
35 static_assert(std::regular<void*>);
36 static_assert(std::regular<int*>);
37 static_assert(std::regular<int const*>);
38 static_assert(std::regular<int volatile*>);
39 static_assert(std::regular<int volatile const*>);
40 static_assert(std::regular<int (*)()>);
42 struct S {};
43 static_assert(!std::regular<S>);
44 static_assert(std::regular<int S::*>);
45 static_assert(std::regular<int (S::*)()>);
46 static_assert(std::regular<int (S::*)() noexcept>);
47 static_assert(std::regular<int (S::*)() &>);
48 static_assert(std::regular<int (S::*)() & noexcept>);
49 static_assert(std::regular<int (S::*)() &&>);
50 static_assert(std::regular<int (S::*)() && noexcept>);
51 static_assert(std::regular<int (S::*)() const>);
52 static_assert(std::regular<int (S::*)() const noexcept>);
53 static_assert(std::regular<int (S::*)() const&>);
54 static_assert(std::regular<int (S::*)() const & noexcept>);
55 static_assert(std::regular<int (S::*)() const&&>);
56 static_assert(std::regular<int (S::*)() const && noexcept>);
57 static_assert(std::regular<int (S::*)() volatile>);
58 static_assert(std::regular<int (S::*)() volatile noexcept>);
59 static_assert(std::regular<int (S::*)() volatile&>);
60 static_assert(std::regular<int (S::*)() volatile & noexcept>);
61 static_assert(std::regular<int (S::*)() volatile&&>);
62 static_assert(std::regular<int (S::*)() volatile && noexcept>);
63 static_assert(std::regular<int (S::*)() const volatile>);
64 static_assert(std::regular<int (S::*)() const volatile noexcept>);
65 static_assert(std::regular<int (S::*)() const volatile&>);
66 static_assert(std::regular<int (S::*)() const volatile & noexcept>);
67 static_assert(std::regular<int (S::*)() const volatile&&>);
68 static_assert(std::regular<int (S::*)() const volatile && noexcept>);
70 union U {};
71 static_assert(!std::regular<U>);
72 static_assert(std::regular<int U::*>);
73 static_assert(std::regular<int (U::*)()>);
74 static_assert(std::regular<int (U::*)() noexcept>);
75 static_assert(std::regular<int (U::*)() &>);
76 static_assert(std::regular<int (U::*)() & noexcept>);
77 static_assert(std::regular<int (U::*)() &&>);
78 static_assert(std::regular<int (U::*)() && noexcept>);
79 static_assert(std::regular<int (U::*)() const>);
80 static_assert(std::regular<int (U::*)() const noexcept>);
81 static_assert(std::regular<int (U::*)() const&>);
82 static_assert(std::regular<int (U::*)() const & noexcept>);
83 static_assert(std::regular<int (U::*)() const&&>);
84 static_assert(std::regular<int (U::*)() const && noexcept>);
85 static_assert(std::regular<int (U::*)() volatile>);
86 static_assert(std::regular<int (U::*)() volatile noexcept>);
87 static_assert(std::regular<int (U::*)() volatile&>);
88 static_assert(std::regular<int (U::*)() volatile & noexcept>);
89 static_assert(std::regular<int (U::*)() volatile&&>);
90 static_assert(std::regular<int (U::*)() volatile && noexcept>);
91 static_assert(std::regular<int (U::*)() const volatile>);
92 static_assert(std::regular<int (U::*)() const volatile noexcept>);
93 static_assert(std::regular<int (U::*)() const volatile&>);
94 static_assert(std::regular<int (U::*)() const volatile & noexcept>);
95 static_assert(std::regular<int (U::*)() const volatile&&>);
96 static_assert(std::regular<int (U::*)() const volatile && noexcept>);
98 static_assert(std::regular<std::vector<int> >);
99 static_assert(std::regular<std::deque<int> >);
100 static_assert(std::regular<std::forward_list<int> >);
101 static_assert(std::regular<std::list<int> >);
102 static_assert(std::regular<std::shared_ptr<std::unique_ptr<int> > >);
103 static_assert(std::regular<std::optional<std::vector<int> > >);
104 static_assert(std::regular<std::vector<int> >);
105 static_assert(std::regular<std::vector<std::unique_ptr<int> > >);
106 static_assert(std::semiregular<std::in_place_t> &&
107 !std::regular<std::in_place_t>);
109 static_assert(!std::regular<has_volatile_member>);
110 static_assert(!std::regular<has_array_member>);
112 // Not objects
113 static_assert(!std::regular<void>);
114 static_assert(!std::regular<int&>);
115 static_assert(!std::regular<int const&>);
116 static_assert(!std::regular<int volatile&>);
117 static_assert(!std::regular<int const volatile&>);
118 static_assert(!std::regular<int&&>);
119 static_assert(!std::regular<int const&&>);
120 static_assert(!std::regular<int volatile&&>);
121 static_assert(!std::regular<int const volatile&&>);
122 static_assert(!std::regular<int()>);
123 static_assert(!std::regular<int (&)()>);
124 static_assert(!std::regular<int[5]>);
126 // not copyable
127 static_assert(!std::regular<std::unique_ptr<int> >);
128 static_assert(!std::regular<int const>);
129 static_assert(!std::regular<int const volatile>);
130 static_assert(!std::regular<volatile_copy_assignment volatile>);
131 static_assert(!std::regular<no_copy_constructor>);
132 static_assert(!std::regular<no_copy_assignment>);
133 static_assert(!std::regular<no_copy_assignment_mutable>);
134 static_assert(!std::regular<derived_from_noncopyable>);
135 static_assert(!std::regular<has_noncopyable>);
136 static_assert(!std::regular<has_const_member>);
137 static_assert(!std::regular<has_cv_member>);
138 static_assert(!std::regular<has_lvalue_reference_member>);
139 static_assert(!std::regular<has_rvalue_reference_member>);
140 static_assert(!std::regular<has_function_ref_member>);
141 static_assert(!std::regular<deleted_assignment_from_const_rvalue>);
143 // not default_initializable
144 static_assert(!std::regular<std::runtime_error>);
145 static_assert(
146 !std::regular<std::tuple<std::runtime_error, std::overflow_error> >);
147 static_assert(!std::regular<std::nullopt_t>);
148 static_assert(!std::regular<no_copy_constructor>);
149 static_assert(!std::regular<no_copy_assignment>);
150 static_assert(std::is_copy_assignable_v<no_copy_assignment_mutable> &&
151 !std::regular<no_copy_assignment_mutable>);
152 static_assert(!std::regular<derived_from_noncopyable>);
153 static_assert(!std::regular<has_noncopyable>);
155 static_assert(!std::regular<derived_from_non_default_initializable>);
156 static_assert(!std::regular<has_non_default_initializable>);
158 // not equality_comparable
159 static_assert(!std::regular<const_copy_assignment const>);
160 static_assert(!std::regular<cv_copy_assignment const volatile>);
162 struct is_equality_comparable {
163 bool operator==(is_equality_comparable const&) const = default;
165 static_assert(std::regular<is_equality_comparable>);