tqchen commented on code in PR #78:
URL: https://github.com/apache/tvm-ffi/pull/78#discussion_r2405854405
##########
include/tvm/ffi/function.h:
##########
@@ -315,21 +315,21 @@ class Function : public ObjectRef {
* \param packed_call The packed function signature
*/
template <typename TCallable>
- static Function FromPacked(TCallable packed_call) {
+ static Function FromPacked(TCallable&& packed_call) {
Review Comment:
this is dangerous, when packed func is a const reference&, std::forward will
forward it as a const reference capture, this can cause issue when packed_call
goes out of bound. For this particular use case, explcit pass by value, then
capture by value(triggered copy elison) the closure is necessary.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]