Closed alexey-malov closed 5 years ago
Fixed by introducing proper move support to function_proxy_impl
I suggest adding a test checking that move constructor works as intended even if function body throws on copy/move
Added tests to check that function's move constructor uses callback's move constructor if it is noexcept and uses copy constructor otherwise
packed_function move constructor and move assignment operators are declared noexcept, however they invoke clone() method which, in turn, invokes Callable's copy constructor via
clone()
which may throw:https://github.com/ispringteam/FastSignals/blob/5c05334245ba0391994788ce8a9cca32ac335fa9/libfastsignals/src/function_detail.cpp#L8-L20
https://github.com/ispringteam/FastSignals/blob/5c05334245ba0391994788ce8a9cca32ac335fa9/libfastsignals/src/function_detail.cpp#L27-L42
For instance, the following test will terminate because of exception within
packed_function
move constructor:In C++20 function's move constructor and move assignment operators will be noexcept. The possible implementation is to store data in small buffer IF the Callable is small enough to fit in buffer AND has nothrowing copy/move constructors