gcc/libstdc++-v3/testsuite/20_util/function
Jonathan Wakely 88b1e41c2d Make std::function tolerate semantically non-CopyConstructible objects
To satisfy the CopyConstructible requirement a callable object stored in
a std::function must behave the same when copied from a const or
non-const source. If copying a non-const object doesn't produce an
equivalent copy then the behaviour is undefined. But we can make our
std::function more tolerant of such objects by ensuring we always copy
from a const lvalue.

Additionally use an if constexpr statement in the _M_get_pointer
function to avoid unnecessary instantiations in the discarded branch.

	* include/bits/std_function.h (_Base_manager::_M_get_pointer):
	Use constexpr if in C++17 mode.
	(_Base_manager::_M_clone(_Any_data&, const _Any_data&, true_type)):
	Copy from const object.
	* testsuite/20_util/function/cons/non_copyconstructible.cc: New.

From-SVN: r260080
2018-05-09 14:28:11 +01:00
..
assign Update copyright years. 2018-01-03 11:03:58 +01:00
cmp Update copyright years. 2018-01-03 11:03:58 +01:00
cons Make std::function tolerate semantically non-CopyConstructible objects 2018-05-09 14:28:11 +01:00
invoke Update copyright years. 2018-01-03 11:03:58 +01:00
requirements Update copyright years. 2018-01-03 11:03:58 +01:00
1.cc Update copyright years. 2018-01-03 11:03:58 +01:00
2.cc Update copyright years. 2018-01-03 11:03:58 +01:00
3.cc Update copyright years. 2018-01-03 11:03:58 +01:00
4.cc Update copyright years. 2018-01-03 11:03:58 +01:00
5.cc Update copyright years. 2018-01-03 11:03:58 +01:00
6.cc Update copyright years. 2018-01-03 11:03:58 +01:00
7.cc Update copyright years. 2018-01-03 11:03:58 +01:00
8.cc Update copyright years. 2018-01-03 11:03:58 +01:00
9.cc Update copyright years. 2018-01-03 11:03:58 +01:00
10.cc Update copyright years. 2018-01-03 11:03:58 +01:00
43397.cc Update copyright years. 2018-01-03 11:03:58 +01:00
48541.cc Update copyright years. 2018-01-03 11:03:58 +01:00
58569.cc Update copyright years. 2018-01-03 11:03:58 +01:00
60594.cc Update copyright years. 2018-01-03 11:03:58 +01:00
63840.cc Update copyright years. 2018-01-03 11:03:58 +01:00
65760.cc Update copyright years. 2018-01-03 11:03:58 +01:00
68995.cc Update copyright years. 2018-01-03 11:03:58 +01:00
69222.cc Update copyright years. 2018-01-03 11:03:58 +01:00
77322.cc Update copyright years. 2018-01-03 11:03:58 +01:00
null_pointer_comparisons.cc Update copyright years. 2018-01-03 11:03:58 +01:00