From: Christopher Dykes Date: Thu, 16 Feb 2017 22:02:54 +0000 (-0800) Subject: Workaround MSVC 2015 limitations in Traits.h X-Git-Tag: v2017.03.06.00~30 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1a8db4b81741a17f8c10e891c16738b744730cc0;p=folly.git Workaround MSVC 2015 limitations in Traits.h Summary: MSVC 2015 has issues with templated `using` declarations using `decltype`, so adjust the definition to use constexpr evaluation to fill a template parameter of a base type instead. Reviewed By: yfeldblum Differential Revision: D4510155 fbshipit-source-id: cc2e33625b515085dff4e682971299810905fef0 --- diff --git a/folly/Traits.h b/folly/Traits.h index 877a325f..ec467180 100644 --- a/folly/Traits.h +++ b/folly/Traits.h @@ -40,14 +40,20 @@ template \ struct classname##__folly_traits_impl__ { \ template \ - static std::true_type test(typename UTheClass_::type_name*); \ + static constexpr bool test(typename UTheClass_::type_name*) { \ + return true; \ + } \ template \ - static std::false_type test(...); \ + static constexpr bool test(...) { \ + return false; \ + } \ }; \ template \ - using classname = decltype( \ + using classname = typename std::conditional< \ classname##__folly_traits_impl__::template test( \ - nullptr)) + nullptr), \ + std::true_type, \ + std::false_type>::type; #define FOLLY_CREATE_HAS_MEMBER_FN_TRAITS_IMPL(classname, func_name, cv_qual) \ template \