File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
libcxx/test/std/utilities/function.objects/func.bind.partial Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,21 @@ constexpr void test_perfect_forwarding_call_wrapper() {
268268 }
269269 }
270270
271+ { // Test perfect forwarding when various overloads are available
272+ struct X {
273+ Tag<0 > operator ()(int &, char ) const ;
274+ Tag<1 > operator ()(const int &, char ) const ;
275+ Tag<2 > operator ()(int &&, char ) const ;
276+ Tag<3 > operator ()(const int &&, char ) const ;
277+ };
278+
279+ using F = decltype (std::bind_front<X{}>(0 ));
280+ static_assert (std::same_as<std::invoke_result_t <F&, char >, Tag<0 >>);
281+ static_assert (std::same_as<std::invoke_result_t <const F&, char >, Tag<1 >>);
282+ static_assert (std::same_as<std::invoke_result_t <F, char >, Tag<2 >>);
283+ static_assert (std::same_as<std::invoke_result_t <const F, char >, Tag<3 >>);
284+ }
285+
271286 { // Test perfect forwarding
272287 auto f = [](int & val) {
273288 val = 5 ;
Original file line number Diff line number Diff line change @@ -45,4 +45,7 @@ struct MaybeNoexceptFn {
4545 bool operator ()() const noexcept (IsNoexcept); // not defined
4646};
4747
48+ template <int >
49+ struct Tag {};
50+
4851#endif // TEST_STD_UTILITIES_FUNCTION_OBJECTS_FUNC_BIND_PARTIAL_TYPES_H
You can’t perform that action at this time.
0 commit comments