Add noexcept-specifier to std::apply and std::make_from_tuple
authorJonathan Wakely <jwakely@redhat.com>
Mon, 12 Aug 2019 14:54:12 +0000 (15:54 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 12 Aug 2019 14:54:12 +0000 (15:54 +0100)
commit6fd4b25b508b55fd3f93d1a9f352d085c175b1f2
tree4ba6092d25863aa4f2f429b4a55801aab9b9f876
parentb0dffed9dae9bd2d61292beb13038414270c03e5
Add noexcept-specifier to std::apply and std::make_from_tuple

When unpacking a std::tuple we know that the std::get calls are
noexcept, so only the invocation (for std::apply) and construction (for
std::make_from_tuple) can throw.

We also know the std::get calls won't throw for a std::array, but this
patch doesn't specialize the variable template for std::array. For an
arbitrary tuple-like type we don't know if the std::get calls will
throw, and so just use a potentially-throwing noexcept-specifier.

* include/std/tuple (__unpack_std_tuple): New variable template and
partial specializations.
(apply, make_from_tuple): Add noexcept-specifier.
* testsuite/20_util/tuple/apply/2.cc: New test.
* testsuite/20_util/tuple/make_from_tuple/2.cc: New test.

From-SVN: r274312
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/tuple
libstdc++-v3/testsuite/20_util/tuple/apply/2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/tuple/make_from_tuple/2.cc [new file with mode: 0644]