From e9440cedcee3bf0988c2ff032f0c70e4a87da57b Mon Sep 17 00:00:00 2001 From: Lewis Baker <lbaker@fb.com> Date: Tue, 23 Apr 2019 11:11:26 -0700 Subject: [PATCH] Don't enable FOLLY_HAS_COROUTINES under MSVC or pre-C++17 Summary: The folly::coro functionality depends heavily on the symmetric-transfer capability of coroutines which MSVC does not yet support. The folly/Portability.h header was previously defining FOLLY_HAS_COROUTINES to true for MSVC even though you would get compile errors if you tried to use any of the folly::coro facilities. Also further restrict defining FOLLY_HAS_COROUTINES only when C++17 or later is available as folly::coro makes use of C++17 language features. Reviewed By: yfeldblum, andriigrynenko Differential Revision: D14811921 fbshipit-source-id: f3da2d3c07fc9ebe08f566a7707c62e74e412df9 --- folly/Portability.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/folly/Portability.h b/folly/Portability.h index 756b029fb..6715c8180 100644 --- a/folly/Portability.h +++ b/folly/Portability.h @@ -473,11 +473,15 @@ constexpr auto kCpplibVer = 0; #define FOLLY_STORAGE_CONSTEXPR constexpr #endif +#if __cplusplus >= 201703L +// folly::coro requires C++17 support #if __cpp_coroutines >= 201703L && __has_include(<experimental/coroutine>) #define FOLLY_HAS_COROUTINES 1 #elif _MSC_VER && _RESUMABLE_FUNCTIONS_SUPPORTED -#define FOLLY_HAS_COROUTINES 1 +// NOTE: MSVC 2017 does not currently support the full Coroutines TS since it +// does not yet support symmetric-transfer. #endif +#endif // __cplusplus >= 201703L // MSVC 2017.5 && C++17 #if __cpp_noexcept_function_type >= 201510 || \ -- 2.26.2