Commit 8a569003 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Fix 1/2 of exception_wrapper under MSVC

Summary:
MSVC didn't like referring to members of `exception_wrapper` in the initializer for a `static constexpr` field directly in `exception_wrapper`, so shift the initialization to the actual definition of the fields.
As the fields are only referred to via their address, dropping the `constexpr` loses nothing.

Reviewed By: ericniebler

Differential Revision: D4873939

fbshipit-source-id: 30b690b1ab3f2f7a25b9dc4863b46f64c811797d
parent e7231fdb
...@@ -21,9 +21,32 @@ ...@@ -21,9 +21,32 @@
namespace folly { namespace folly {
constexpr exception_wrapper::VTable const exception_wrapper::uninit_; exception_wrapper::VTable const exception_wrapper::uninit_{
constexpr exception_wrapper::VTable const exception_wrapper::ExceptionPtr::ops_; &noop_<void, exception_wrapper const*, exception_wrapper*>,
constexpr exception_wrapper::VTable const exception_wrapper::SharedPtr::ops_; &noop_<void, exception_wrapper*, exception_wrapper*>,
&noop_<void, exception_wrapper*>,
&noop_<void, exception_wrapper const*>,
&uninit_type_,
&noop_<std::exception const*, exception_wrapper const*>,
&noop_<exception_wrapper, exception_wrapper const*>};
exception_wrapper::VTable const exception_wrapper::ExceptionPtr::ops_{
copy_,
move_,
delete_,
throw_,
type_,
get_exception_,
get_exception_ptr_};
exception_wrapper::VTable const exception_wrapper::SharedPtr::ops_{
copy_,
move_,
delete_,
throw_,
type_,
get_exception_,
get_exception_ptr_};
namespace { namespace {
std::exception const* get_std_exception_(std::exception_ptr eptr) noexcept { std::exception const* get_std_exception_(std::exception_ptr eptr) noexcept {
......
...@@ -203,14 +203,7 @@ class exception_wrapper final { ...@@ -203,14 +203,7 @@ class exception_wrapper final {
static std::type_info const* uninit_type_(exception_wrapper const*); static std::type_info const* uninit_type_(exception_wrapper const*);
static constexpr VTable const uninit_{ static VTable const uninit_;
&noop_<void, exception_wrapper const*, exception_wrapper*>,
&noop_<void, exception_wrapper*, exception_wrapper*>,
&noop_<void, exception_wrapper*>,
&noop_<void, exception_wrapper const*>,
&uninit_type_,
&noop_<std::exception const*, exception_wrapper const*>,
&noop_<exception_wrapper, exception_wrapper const*>};
template <class Ex> template <class Ex>
using IsStdException = std::is_base_of<std::exception, _t<std::decay<Ex>>>; using IsStdException = std::is_base_of<std::exception, _t<std::decay<Ex>>>;
...@@ -277,13 +270,7 @@ class exception_wrapper final { ...@@ -277,13 +270,7 @@ class exception_wrapper final {
static std::type_info const* type_(exception_wrapper const* that); static std::type_info const* type_(exception_wrapper const* that);
static std::exception const* get_exception_(exception_wrapper const* that); static std::exception const* get_exception_(exception_wrapper const* that);
static exception_wrapper get_exception_ptr_(exception_wrapper const* that); static exception_wrapper get_exception_ptr_(exception_wrapper const* that);
static constexpr VTable const ops_{copy_, static VTable const ops_;
move_,
delete_,
throw_,
type_,
get_exception_,
get_exception_ptr_};
}; };
template <class Ex> template <class Ex>
...@@ -334,13 +321,7 @@ class exception_wrapper final { ...@@ -334,13 +321,7 @@ class exception_wrapper final {
static std::type_info const* type_(exception_wrapper const* that); static std::type_info const* type_(exception_wrapper const* that);
static std::exception const* get_exception_(exception_wrapper const* that); static std::exception const* get_exception_(exception_wrapper const* that);
static exception_wrapper get_exception_ptr_(exception_wrapper const* that); static exception_wrapper get_exception_ptr_(exception_wrapper const* that);
static constexpr VTable ops_{copy_, static VTable const ops_;
move_,
delete_,
throw_,
type_,
get_exception_,
get_exception_ptr_};
}; };
union { union {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment