File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
libcxx/test/std/utilities/function.objects/func.bind.partial Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 2121#include < type_traits>
2222#include < utility>
2323
24+ #include " test_macros.h"
2425#include " types.h"
2526
2627constexpr void test_basic_bindings () {
@@ -343,6 +344,23 @@ constexpr void test_return_type() {
343344 static_assert (!noexcept (never_noexcept ()));
344345 }
345346
347+ #ifndef TEST_HAS_NO_EXCEPTIONS
348+ # ifndef __cpp_constexpr_exceptions
349+ if !consteval
350+ # endif
351+ { // Test exception propagation
352+ auto throws = [](int x, int y) { throw x + y; };
353+ auto f = std::bind_front<throws>(10 );
354+ static_assert (!noexcept (f (20 )));
355+
356+ try {
357+ f (20 );
358+ } catch (int z) {
359+ assert (z == 30 );
360+ }
361+ }
362+ #endif // TEST_HAS_NO_EXCEPTIONS
363+
346364 { // Test calling volatile wrapper -- we allow it as an extension
347365 using Fn = decltype (std::bind_front<std::integral_constant<int , 0 >{}>());
348366 static_assert (std::invocable<volatile Fn&>);
You can’t perform that action at this time.
0 commit comments