diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst index d20c19f3a29f..5df6242e5231 100644 --- a/libcxx/docs/ReleaseNotes/18.rst +++ b/libcxx/docs/ReleaseNotes/18.rst @@ -59,6 +59,7 @@ Implemented Papers - P2821R5 - span.at() - P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique) - P1759R6 - Native handles and file streams +- P2517R1 - Add a conditional ``noexcept`` specification to ``std::apply`` Improvements and New Features diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv index 03c12247cd85..ebab3ef735b6 100644 --- a/libcxx/docs/Status/Cxx23Papers.csv +++ b/libcxx/docs/Status/Cxx23Papers.csv @@ -83,7 +83,7 @@ "`P2502R2 `__","LWG","``std::generator``: Synchronous Coroutine Generator for Ranges","July 2022","","","|ranges|" "`P2508R1 `__","LWG","Exposing ``std::basic-format-string``","July 2022","|Complete|","15.0" "`P2513R4 `__","LWG","``char8_t`` Compatibility and Portability Fixes","July 2022","","" -"`P2517R1 `__","LWG","Add a conditional ``noexcept`` specification to ``std::apply``","July 2022","","" +"`P2517R1 `__","LWG","Add a conditional ``noexcept`` specification to ``std::apply``","July 2022","|Complete|","3.9" "`P2520R0 `__","LWG","``move_iterator`` should be a random access iterator","July 2022","|Complete| [#note-P2520R0]_","17.0","|ranges|" "`P2540R1 `__","LWG","Empty Product for certain Views","July 2022","","","|ranges|" "`P2549R1 `__","LWG","``std::unexpected`` should have ``error()`` as member accessor","July 2022","|Complete|","16.0" diff --git a/libcxx/include/tuple b/libcxx/include/tuple index aa22c320b1ec..0e5f0b4831b4 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -141,7 +141,7 @@ template tuple tuple_cat(Tuples&&... tpls); // cons // [tuple.apply], calling a function with a tuple of arguments: template - constexpr decltype(auto) apply(F&& f, Tuple&& t); // C++17 + constexpr decltype(auto) apply(F&& f, Tuple&& t) noexcept(see below); // C++17 noexcept since C++23 template constexpr T make_from_tuple(Tuple&& t); // C++17 diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp index 6ca3f2045e49..af3752752207 100644 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/apply.pass.cpp @@ -10,7 +10,7 @@ // -// template constexpr decltype(auto) apply(F &&, T &&) +// template constexpr decltype(auto) apply(F &&, T &&) noexcept(see below) // noexcept since C++23 // Test with different ref/ptr/cv qualified argument types. @@ -192,7 +192,11 @@ void test_noexcept() // test that the functions noexcept-ness is propagated using Tup = std::tuple; Tup t; +#if TEST_STD_VER >= 23 + ASSERT_NOEXCEPT(std::apply(nec, t)); +#else LIBCPP_ASSERT_NOEXCEPT(std::apply(nec, t)); +#endif ASSERT_NOT_NOEXCEPT(std::apply(tc, t)); } { @@ -200,7 +204,11 @@ void test_noexcept() using Tup = std::tuple; Tup t; ASSERT_NOT_NOEXCEPT(std::apply(nec, t)); +#if TEST_STD_VER >= 23 + ASSERT_NOEXCEPT(std::apply(nec, std::move(t))); +#else LIBCPP_ASSERT_NOEXCEPT(std::apply(nec, std::move(t))); +#endif } }