Skip to content

Commit 8c861c4

Browse files
committed
Update test file to conform to the proposal
1 parent db2c68a commit 8c861c4

File tree

1 file changed

+4
-51
lines changed

1 file changed

+4
-51
lines changed

test.cpp

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
#include <functional>
22
#include <type_traits>
33

4-
void check_return_type_are_correct();
54
void check_forward();
65
void check_raii();
76
void check_noexcept_spec();
87

98
struct Widget {};
10-
bool test(int) => true;
11-
bool test(Widget) => false;
9+
auto test(int) => true;
10+
auto test(Widget) => false;
1211
void invoke(std::function<bool(int)>) {}
1312
void invoke(std::function<bool(std::string)>) {}
1413

1514
template <class T>
16-
constexpr bool is_rvalue_ref(T&&) => std::is_rvalue_reference_v<T&&>;
15+
constexpr auto is_rvalue_ref(T&&) => std::is_rvalue_reference_v<T&&>;
1716

18-
int&& f(int&& x) noexcept(true) => (>>x);
17+
auto f(int&& x) => (>>x);
1918

2019
int main()
2120
{
@@ -26,7 +25,6 @@ int main()
2625

2726
check_raii();
2827
check_forward();
29-
check_return_type_are_correct();
3028
check_noexcept_spec();
3129
}
3230

@@ -56,51 +54,6 @@ void check_optional_type_for_parameter()
5654
[](x...) { static_assert((is_rvalue_ref(>>x) && ...)); }(42);
5755
}
5856

59-
template<class T> constexpr auto func_1(T&& x) => (>>x);
60-
template<class T> constexpr auto func_2(T&& x) -> decltype((>>x)) => (>>x);
61-
template<class T> constexpr auto func_3(T&& x) => (x);
62-
template<class T> constexpr auto func_4(T&& x) -> decltype((x)) => (x);
63-
64-
void check_return_type_are_correct()
65-
{
66-
int i = 0, &&v = 0;
67-
68-
constexpr auto make_is_same = []<class L, class R>(L&&, R&&) {
69-
static_assert(std::is_same_v<L, R>);
70-
};
71-
constexpr auto lambda_1 = []<class T>(T&& x) => (>>x);
72-
constexpr auto lambda_2 = []<class T>(T&& x) -> decltype((>>x)) => (>>x);
73-
constexpr auto lambda_3 = []<class T>(T&& x) => (x);
74-
constexpr auto lambda_4 = []<class T>(T&& x) -> decltype((x)) => (x);
75-
76-
#define SAME_F(funcA, funcB, args...) \
77-
make_is_same(funcA(args), funcB(args))
78-
79-
SAME_F(lambda_1, lambda_2, 42);
80-
SAME_F(lambda_1, lambda_2, i);
81-
SAME_F(lambda_1, lambda_2, v);
82-
SAME_F(lambda_1, lambda_2, >>i);
83-
SAME_F(lambda_1, lambda_2, >>v);
84-
85-
SAME_F(lambda_3, lambda_4, 42);
86-
SAME_F(lambda_3, lambda_4, i);
87-
SAME_F(lambda_3, lambda_4, v);
88-
SAME_F(lambda_3, lambda_4, >>i);
89-
SAME_F(lambda_3, lambda_4, >>v);
90-
91-
SAME_F(func_1, func_2, 42);
92-
SAME_F(func_1, func_2, i);
93-
SAME_F(func_1, func_2, v);
94-
SAME_F(func_1, func_2, >>i);
95-
SAME_F(func_1, func_2, >>v);
96-
97-
SAME_F(func_3, func_4, 42);
98-
SAME_F(func_3, func_4, i);
99-
SAME_F(func_3, func_4, v);
100-
SAME_F(func_3, func_4, >>i);
101-
SAME_F(func_3, func_4, >>v);
102-
}
103-
10457
void check_noexcept_spec()
10558
{
10659
auto excepts = []<class T>(T&&) noexcept(false) { throw 42; };

0 commit comments

Comments
 (0)