Fix exception_wrapper on Windows by abusing internals
authorAndrew Krieger <andrew.krieger@oculus.com>
Fri, 23 Jun 2017 20:58:11 +0000 (13:58 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 23 Jun 2017 21:05:31 +0000 (14:05 -0700)
commite7e6d29a00b685ab673fd76250ca3354088de46b
treecf918a30385406e85b4457be0d4c953545fa3c94
parenta325a1c80ff208a2dc04f3d7d1cd320b88d10069
Fix exception_wrapper on Windows by abusing internals

Summary:
exception_wrapper's non-allocating variant was depending
on the exception reference being a reference to a heap object,
which is not the case on Windows. All thrown exceptions are
copied to the stack first.

So, we abuse internals of exception_ptr to get the internally
heap allocated copy of the object. What could possibly go wrong.

Reviewed By: yfeldblum, ericniebler, Orvid

Differential Revision: D5270634

fbshipit-source-id: 2983a6af9a2c3cb66cbee8a382707a76b582c489
folly/ExceptionWrapper-inl.h
folly/ExceptionWrapper.h
folly/Portability.h