gcc/libstdc++-v3/include
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
..
backward PR libstdc++/69608 Move semantics for strstreambuf 2018-05-02 17:25:44 +01:00
bits Make std::function tolerate semantically non-CopyConstructible objects 2018-05-09 14:28:11 +01:00
c Update copyright years. 2018-01-03 11:03:58 +01:00
c_compatibility Update copyright years. 2018-01-03 11:03:58 +01:00
c_global PR libstdc++/84773 use aligned alloc functions for FreeBSD and MinGW cross-compilers 2018-03-12 22:52:16 +00:00
c_std Update copyright years. 2018-01-03 11:03:58 +01:00
debug macros.h (__glibcxx_check_valid_range_at): New. 2018-05-08 19:46:59 +00:00
decimal Update copyright years. 2018-01-03 11:03:58 +01:00
experimental PR libstdc++/85671 allow copy elision in path concatenation 2018-05-07 18:26:28 +01:00
ext aligned_buffer.h [...] (template<> __aligned_buffer): Define as __aligned_membuf alias. 2018-02-20 20:51:44 +00:00
parallel Update copyright years. 2018-01-03 11:03:58 +01:00
precompiled Update copyright years. 2018-01-03 11:03:58 +01:00
profile Update copyright years. 2018-01-03 11:03:58 +01:00
std Rollback bad commits! Sorry! 2018-05-07 16:13:48 +00:00
tr1 Rollback bad commits! Sorry! 2018-05-07 16:13:48 +00:00
tr2 Update copyright years. 2018-01-03 11:03:58 +01:00
Makefile.am PR libstdc++/85672 #undef _GLIBCXX_USE_FLOAT128 when not supported 2018-05-08 14:05:04 +01:00
Makefile.in PR libstdc++/85672 #undef _GLIBCXX_USE_FLOAT128 when not supported 2018-05-08 14:05:04 +01:00