aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-06-08 15:27:45 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2017-06-08 15:27:45 +0100
commit853ed6bc10c6948ffd1d3c6730d78818375458e1 (patch)
tree7a463069bf00a2a81d2e1d8e1fcb7cc9006a350c
parent0b6bc904227e2dae47f178e4d5468931669df197 (diff)
downloadgcc-853ed6bc10c6948ffd1d3c6730d78818375458e1.zip
gcc-853ed6bc10c6948ffd1d3c6730d78818375458e1.tar.gz
gcc-853ed6bc10c6948ffd1d3c6730d78818375458e1.tar.bz2
PR libstdc++/81017 add noexcept to std::function move operations
PR libstdc++/81017 * include/bits/std_function.h (function::function(function&&)) (function::operator=(funtion&&)): Add noexcept. * testsuite/20_util/function/assign/move.cc: Check for noexcept. * testsuite/20_util/function/cons/move.cc: Likewise. From-SVN: r249018
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/bits/std_function.h4
-rw-r--r--libstdc++-v3/testsuite/20_util/function/assign/move.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cons/move.cc5
4 files changed, 16 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a53c1ec..6896c15 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2017-06-08 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/81017
+ * include/bits/std_function.h (function::function(function&&))
+ (function::operator=(funtion&&)): Add noexcept.
+ * testsuite/20_util/function/assign/move.cc: Check for noexcept.
+ * testsuite/20_util/function/cons/move.cc: Likewise.
+
2017-06-07 Jonathan Wakely <jwakely@redhat.com>
* include/bits/regex.h (basic_regex): Add deduction guide from P0433.
diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h
index c4ea347..a9ba756 100644
--- a/libstdc++-v3/include/bits/std_function.h
+++ b/libstdc++-v3/include/bits/std_function.h
@@ -438,7 +438,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* The newly-created %function contains the target of @a __x
* (if it has one).
*/
- function(function&& __x) : _Function_base()
+ function(function&& __x) noexcept : _Function_base()
{
__x.swap(*this);
}
@@ -495,7 +495,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* object, then this operation will not throw an %exception.
*/
function&
- operator=(function&& __x)
+ operator=(function&& __x) noexcept
{
function(std::move(__x)).swap(*this);
return *this;
diff --git a/libstdc++-v3/testsuite/20_util/function/assign/move.cc b/libstdc++-v3/testsuite/20_util/function/assign/move.cc
index 5264623..8658527 100644
--- a/libstdc++-v3/testsuite/20_util/function/assign/move.cc
+++ b/libstdc++-v3/testsuite/20_util/function/assign/move.cc
@@ -38,11 +38,12 @@ void test01()
fo2 = (std::move(fo));
VERIFY( static_cast<bool>(fo2) );
VERIFY( fo2() == 2 );
+
+ static_assert(std::is_nothrow_move_assignable<function>::value,
+ "PR libstdc++/81017");
}
int main()
{
test01();
-
- return 0;
}
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/move.cc b/libstdc++-v3/testsuite/20_util/function/cons/move.cc
index 1cdfeed..7dbc511 100644
--- a/libstdc++-v3/testsuite/20_util/function/cons/move.cc
+++ b/libstdc++-v3/testsuite/20_util/function/cons/move.cc
@@ -36,11 +36,12 @@ void test01()
function fo2(std::move(fo));
VERIFY( static_cast<bool>(fo2) );
VERIFY( fo2() == 2 );
+
+ static_assert(std::is_nothrow_move_constructible<function>::value,
+ "PR libstdc++/81017");
}
int main()
{
test01();
-
- return 0;
}