Commit b9a450ef authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Use feature test macro for deduction guide in Replaceable.h (#1065)

Summary:
- Replace a check for deduction guide support to use a feature test macro
  for deduction guides rather than a check using `__cplusplus` directive.
- The existing check using the `__cplusplus` directive is not correct
  for GCC 5.1. With GCC 5.1, `__cplusplus > 201402L` will be true, but the check
  for `#if __cpp_deduction_guides >= 201703` will be false. So, it is
  not valid to just rely on the `__cplusplus` directive to infer
  deduction guide support.
- We extend the check to use the feature test macro except in the case
  of MSVC, which we infer the feature is supported. MSVC does not define
  feature test macros, despite having implemented the feature.
Pull Request resolved: https://github.com/facebook/folly/pull/1065

Reviewed By: aary

Differential Revision: D14518809

Pulled By: yfeldblum

fbshipit-source-id: a976ae527ef986ae6d3fc52c316af9bf8e209767
parent d1ef780f
......@@ -640,8 +640,7 @@ class alignas(T) Replaceable
aligned_storage_for_t<T> storage_[1];
};
#if __cplusplus > 201402L
// C++17 allows us to define a deduction guide:
#if __cpp_deduction_guides >= 201703 || _MSC_VER
template <class T>
Replaceable(T)->Replaceable<T>;
#endif
......
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