gen::dereference should perfectly-forward unwrapped values
authorYedidya Feldblum <yfeldblum@fb.com>
Mon, 29 Aug 2016 21:57:05 +0000 (14:57 -0700)
committerFacebook Github Bot 2 <facebook-github-bot-2-bot@fb.com>
Mon, 29 Aug 2016 22:08:29 +0000 (15:08 -0700)
commit2dedc14bc6f68c740555aca71fe747f512e9138e
tree57b370748866aebbdc573c3bd139332f61b5b95c
parent214d5f7cbe007028ae50d91615ec7ae4ffcdb04a
gen::dereference should perfectly-forward unwrapped values

Summary:
[Folly] `gen::dereference` should perfectly-forward unwrapped values.

The problem comes in when the wrapped value is not actually a pointer, but is actually an rvalue-ref to some other kind of wrapper type with `Inner&& operator*() &&`. In such cases, the compiler emits a type mismatch error that it cannot cast `Inner` to `Inner&&`, with the errors originating in `Dereference::foreach` and `Dereference::apply`.

Fixes a couple other missing-forwarding and extra-forwarding bugs.

Reviewed By: ddrcoder

Differential Revision: D3776617

fbshipit-source-id: 6926fc18244a572846b22d428bd407d37fb20aa1
folly/gen/Base-inl.h
folly/gen/test/BaseTest.cpp