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
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
assign | Loading commit data... | |
cmp | Loading commit data... | |
cons | Loading commit data... | |
invoke | Loading commit data... | |
requirements | Loading commit data... | |
1.cc | Loading commit data... | |
10.cc | Loading commit data... | |
2.cc | Loading commit data... | |
3.cc | Loading commit data... | |
4.cc | Loading commit data... | |
43397.cc | Loading commit data... | |
48541.cc | Loading commit data... | |
5.cc | Loading commit data... | |
58569.cc | Loading commit data... | |
6.cc | Loading commit data... | |
60594.cc | Loading commit data... | |
63840.cc | Loading commit data... | |
65760.cc | Loading commit data... | |
68995.cc | Loading commit data... | |
69222.cc | Loading commit data... | |
7.cc | Loading commit data... | |
77322.cc | Loading commit data... | |
8.cc | Loading commit data... | |
9.cc | Loading commit data... | |
null_pointer_comparisons.cc | Loading commit data... |