prevent folly::Function<T const&()> from being initialized with a function that retur...
authorEric Niebler <eniebler@fb.com>
Fri, 8 Dec 2017 06:36:49 +0000 (22:36 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 8 Dec 2017 06:54:17 +0000 (22:54 -0800)
commitf193a7e397b220a9d1ecc34183b6cffc279c9275
tree7c3f1404c59b8aecb220dbbd802e6893fadb7bbd
parente67115846d699e1c149f5ed2b106b72c78dd40ce
prevent folly::Function<T const&()> from being initialized with a function that returns a prvalue

Summary: If the folly::Function returns by const& and the wrapped function returns a prvalue, it is guaranteed to return a dangling reference. Prevent it.

Reviewed By: yfeldblum, aary

Differential Revision: D6487447

fbshipit-source-id: 61700b4688e29409eefa27f546b31ecac258cfdd
folly/Function.h
folly/test/FunctionTest.cpp