mirror of git://gcc.gnu.org/git/gcc.git
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 |
||
|---|---|---|
| .. | ||
| assign | ||
| cmp | ||
| cons | ||
| invoke | ||
| requirements | ||
| 1.cc | ||
| 2.cc | ||
| 3.cc | ||
| 4.cc | ||
| 5.cc | ||
| 6.cc | ||
| 7.cc | ||
| 8.cc | ||
| 9.cc | ||
| 10.cc | ||
| 43397.cc | ||
| 48541.cc | ||
| 58569.cc | ||
| 60594.cc | ||
| 63840.cc | ||
| 65760.cc | ||
| 68995.cc | ||
| 69222.cc | ||
| 77322.cc | ||
| null_pointer_comparisons.cc | ||