| 11 | struct list {}; |
| 12 | |
| 13 | int main() { |
| 14 | using namespace boost::ut; |
| 15 | |
| 16 | static constexpr auto i = 42; |
| 17 | |
| 18 | "type"_test = [] { |
| 19 | constexpr auto return_int = [] { return i; }; |
| 20 | |
| 21 | expect(type<>(i) == type<int>); |
| 22 | expect(type<int> == type<>(i)); |
| 23 | expect(type<int> == return_int()); |
| 24 | expect(type<float> != return_int()); |
| 25 | }; |
| 26 | |
| 27 | "constant"_test = [] { |
| 28 | // clang-format off |
| 29 | expect(constant<42_i == i> and type<void> == type<void> and |
| 30 | type<list<void, int>> == type<list<void, int>>); |
| 31 | // clang-format on |
| 32 | }; |
| 33 | |
| 34 | #if defined(__cpp_concepts) |
| 35 | "compiles"_test = [] { |
| 36 | struct foo { |
| 37 | int value{}; |
| 38 | }; |
| 39 | struct bar {}; |
| 40 | |
| 41 | expect([](auto t) { return requires { t.value; }; }(foo{})); |
| 42 | expect(not[](auto t) { return requires { t.value; }; }(bar{})); |
| 43 | }; |
| 44 | #endif |
| 45 | } |