1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
12 // concept semiregular = see below;
17 #include <forward_list>
24 #include <unordered_map>
27 #include "type_classification/semiregular.h"
29 static_assert(std::semiregular
<int>);
30 static_assert(std::semiregular
<int volatile>);
31 static_assert(std::semiregular
<int*>);
32 static_assert(std::semiregular
<int const*>);
33 static_assert(std::semiregular
<int volatile*>);
34 static_assert(std::semiregular
<int volatile const*>);
35 static_assert(std::semiregular
<int (*)()>);
38 static_assert(std::semiregular
<S
>);
39 static_assert(std::semiregular
<int S::*>);
40 static_assert(std::semiregular
<int (S::*)()>);
41 static_assert(std::semiregular
<int (S::*)() noexcept
>);
42 static_assert(std::semiregular
<int (S::*)() &>);
43 static_assert(std::semiregular
<int (S::*)() & noexcept
>);
44 static_assert(std::semiregular
<int (S::*)() &&>);
45 static_assert(std::semiregular
<int (S::*)() && noexcept
>);
46 static_assert(std::semiregular
<int (S::*)() const>);
47 static_assert(std::semiregular
<int (S::*)() const noexcept
>);
48 static_assert(std::semiregular
<int (S::*)() const&>);
49 static_assert(std::semiregular
<int (S::*)() const & noexcept
>);
50 static_assert(std::semiregular
<int (S::*)() const&&>);
51 static_assert(std::semiregular
<int (S::*)() const && noexcept
>);
52 static_assert(std::semiregular
<int (S::*)() volatile>);
53 static_assert(std::semiregular
<int (S::*)() volatile noexcept
>);
54 static_assert(std::semiregular
<int (S::*)() volatile&>);
55 static_assert(std::semiregular
<int (S::*)() volatile & noexcept
>);
56 static_assert(std::semiregular
<int (S::*)() volatile&&>);
57 static_assert(std::semiregular
<int (S::*)() volatile && noexcept
>);
58 static_assert(std::semiregular
<int (S::*)() const volatile>);
59 static_assert(std::semiregular
<int (S::*)() const volatile noexcept
>);
60 static_assert(std::semiregular
<int (S::*)() const volatile&>);
61 static_assert(std::semiregular
<int (S::*)() const volatile & noexcept
>);
62 static_assert(std::semiregular
<int (S::*)() const volatile&&>);
63 static_assert(std::semiregular
<int (S::*)() const volatile && noexcept
>);
65 static_assert(std::semiregular
<std::vector
<int> >);
66 static_assert(std::semiregular
<std::deque
<int> >);
67 static_assert(std::semiregular
<std::forward_list
<int> >);
68 static_assert(std::semiregular
<std::list
<int> >);
69 static_assert(std::semiregular
<std::shared_ptr
<std::unique_ptr
<int> > >);
70 static_assert(std::semiregular
<std::optional
<std::vector
<int> > >);
71 static_assert(std::semiregular
<std::vector
<int> >);
72 static_assert(std::semiregular
<std::vector
<std::unique_ptr
<int> > >);
74 static_assert(std::semiregular
<has_volatile_member
>);
75 static_assert(std::semiregular
<has_array_member
>);
78 static_assert(!std::semiregular
<void>);
79 static_assert(!std::semiregular
<int&>);
80 static_assert(!std::semiregular
<int const&>);
81 static_assert(!std::semiregular
<int volatile&>);
82 static_assert(!std::semiregular
<int const volatile&>);
83 static_assert(!std::semiregular
<int&&>);
84 static_assert(!std::semiregular
<int const&&>);
85 static_assert(!std::semiregular
<int volatile&&>);
86 static_assert(!std::semiregular
<int const volatile&&>);
87 static_assert(!std::semiregular
<int()>);
88 static_assert(!std::semiregular
<int (&)()>);
89 static_assert(!std::semiregular
<int[5]>);
92 static_assert(!std::semiregular
<std::unique_ptr
<int> >);
93 static_assert(!std::semiregular
<int const>);
94 static_assert(!std::semiregular
<int const volatile>);
95 static_assert(std::semiregular
<const_copy_assignment
const>);
96 static_assert(!std::semiregular
<volatile_copy_assignment
volatile>);
97 static_assert(std::semiregular
<cv_copy_assignment
const volatile>);
98 static_assert(!std::semiregular
<no_copy_constructor
>);
99 static_assert(!std::semiregular
<no_copy_assignment
>);
100 static_assert(!std::semiregular
<no_copy_assignment_mutable
>);
101 static_assert(!std::semiregular
<derived_from_noncopyable
>);
102 static_assert(!std::semiregular
<has_noncopyable
>);
103 static_assert(!std::semiregular
<has_const_member
>);
104 static_assert(!std::semiregular
<has_cv_member
>);
105 static_assert(!std::semiregular
<has_lvalue_reference_member
>);
106 static_assert(!std::semiregular
<has_rvalue_reference_member
>);
107 static_assert(!std::semiregular
<has_function_ref_member
>);
108 static_assert(!std::semiregular
<deleted_assignment_from_const_rvalue
>);
110 // Not default_initializable
111 static_assert(!std::semiregular
<std::runtime_error
>);
113 !std::semiregular
<std::tuple
<std::runtime_error
, std::overflow_error
> >);
114 static_assert(!std::semiregular
<std::nullopt_t
>);
115 static_assert(!std::semiregular
<no_copy_constructor
>);
116 static_assert(!std::semiregular
<no_copy_assignment
>);
117 static_assert(std::is_copy_assignable_v
<no_copy_assignment_mutable
>);
118 static_assert(!std::semiregular
<no_copy_assignment_mutable
>);
119 static_assert(!std::semiregular
<derived_from_noncopyable
>);
120 static_assert(!std::semiregular
<has_noncopyable
>);
122 static_assert(!std::semiregular
<no_default_ctor
>);
123 static_assert(!std::semiregular
<derived_from_non_default_initializable
>);
124 static_assert(!std::semiregular
<has_non_default_initializable
>);
126 static_assert(!std::semiregular
<deleted_default_ctor
>);
127 static_assert(!std::semiregular
<derived_from_deleted_default_ctor
>);
128 static_assert(!std::semiregular
<has_deleted_default_ctor
>);