From 1a8db4b81741a17f8c10e891c16738b744730cc0 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Thu, 16 Feb 2017 14:02:54 -0800 Subject: [PATCH] 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 --- folly/Traits.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 \ -- 2.34.1