Fix the last issues with exception_wrapper under MSVC
authorChristopher Dykes <cdykes@fb.com>
Thu, 13 Apr 2017 01:19:37 +0000 (18:19 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 13 Apr 2017 01:22:32 +0000 (18:22 -0700)
Summary:
Well, MSVC 2017 anyways.
MSVC 2017 wasn't able to handle the decltype in the type specialization, which was also entirely unnecesary.

Reviewed By: yfeldblum

Differential Revision: D4880272

fbshipit-source-id: b6deed72a12d4b58d6eca200e7287e536f94ca30

folly/ExceptionWrapper-inl.h
folly/ExceptionWrapper.h

index 175484454bf596968d43f5dfcf19cfc1d74e3474..0de18b0c7aa5e2a464457db6b807818dbfcc9275 100644 (file)
 namespace folly {
 
 template <class Fn>
 namespace folly {
 
 template <class Fn>
-struct exception_wrapper::arg_type2_ {};
+struct exception_wrapper::arg_type_
+    : public arg_type_<decltype(&Fn::operator())> {
+};
 template <class Ret, class Class, class Arg>
 template <class Ret, class Class, class Arg>
-struct exception_wrapper::arg_type2_<Ret (Class::*)(Arg)> {
+struct exception_wrapper::arg_type_<Ret (Class::*)(Arg)> {
   using type = Arg;
 };
 template <class Ret, class Class, class Arg>
   using type = Arg;
 };
 template <class Ret, class Class, class Arg>
-struct exception_wrapper::arg_type2_<Ret (Class::*)(Arg) const> {
+struct exception_wrapper::arg_type_<Ret (Class::*)(Arg) const> {
+  using type = Arg;
+};
+template <class Ret, class Arg>
+struct exception_wrapper::arg_type_<Ret (Arg)> {
+  using type = Arg;
+};
+template <class Ret, class Arg>
+struct exception_wrapper::arg_type_<Ret (*)(Arg)> {
   using type = Arg;
 };
 template <class Ret, class Class>
   using type = Arg;
 };
 template <class Ret, class Class>
-struct exception_wrapper::arg_type2_<Ret (Class::*)(...)> {
+struct exception_wrapper::arg_type_<Ret (Class::*)(...)> {
   using type = AnyException;
 };
 template <class Ret, class Class>
   using type = AnyException;
 };
 template <class Ret, class Class>
-struct exception_wrapper::arg_type2_<Ret (Class::*)(...) const> {
+struct exception_wrapper::arg_type_<Ret (Class::*)(...) const> {
   using type = AnyException;
 };
   using type = AnyException;
 };
-
-template <class Fn, class>
-struct exception_wrapper::arg_type_ {};
-template <class Fn>
-struct exception_wrapper::arg_type_<Fn, void_t<decltype(&Fn::operator())>>
-    : public arg_type2_<decltype(&Fn::operator())> {};
-template <class Ret, class Arg>
-struct exception_wrapper::arg_type_<Ret (*)(Arg)> {
-  using type = Arg;
+template <class Ret>
+struct exception_wrapper::arg_type_<Ret (...)> {
+  using type = AnyException;
 };
 template <class Ret>
 struct exception_wrapper::arg_type_<Ret (*)(...)> {
 };
 template <class Ret>
 struct exception_wrapper::arg_type_<Ret (*)(...)> {
index fa91d45870ad1ac9ad3f4c5a812e5499d71b9f18..dcdf862870863c25585415d15497505f01c4f5fc 100644 (file)
@@ -168,8 +168,6 @@ class exception_wrapper final {
   };
 
   template <class Fn>
   };
 
   template <class Fn>
-  struct arg_type2_;
-  template <class Fn, class = void>
   struct arg_type_;
   template <class Fn>
   using arg_type = _t<arg_type_<Fn>>;
   struct arg_type_;
   template <class Fn>
   using arg_type = _t<arg_type_<Fn>>;