Test issue #2234: overload_cast must handle noexcept member and free function pointers. In C++17 noexcept is part of the function type, so overload_cast_impl needs dedicated operator() overloads for noexcept free functions and non-const/const member functions.
()
| 601 | |
| 602 | |
| 603 | def test_noexcept_overload_cast(): |
| 604 | """Test issue #2234: overload_cast must handle noexcept member and free function pointers. |
| 605 | |
| 606 | In C++17 noexcept is part of the function type, so overload_cast_impl needs dedicated |
| 607 | operator() overloads for noexcept free functions and non-const/const member functions. |
| 608 | """ |
| 609 | obj = m.NoexceptOverloaded() |
| 610 | # overload_cast_impl::operator()(Return (Class::*)(Args...) noexcept, false_type) |
| 611 | assert obj.method(1) == "(int)" |
| 612 | # overload_cast_impl::operator()(Return (Class::*)(Args...) const noexcept, true_type) |
| 613 | assert obj.method_const(2) == "(int) const" |
| 614 | # overload_cast_impl::operator()(Return (Class::*)(Args...) noexcept, false_type) float |
| 615 | assert obj.method_float(3.0) == "(float)" |
| 616 | # overload_cast_impl::operator()(Return (*)(Args...) noexcept) |
| 617 | assert m.noexcept_free_func(10) == 11 |
| 618 | assert m.noexcept_free_func_float(10.0) == 12 |
| 619 | |
| 620 | |
| 621 | def test_ref_qualified_overload_cast(): |