Commit fb28875b authored by Paul Rosania's avatar Paul Rosania Committed by Facebook Github Bot

Detect `std::launder` in libc++ 6 (and Xcode 10) (#948)

Summary:
Fixes #947.

>libc++ 6+ (and Xcode 10's libc++, which seems to be based on it) adds std::launder, but does not define the __cpp_lib_launder feature-test macro. As a result, folly's lang/Launder.h concludes std::launder is missing and defines its own implementation. Since std::launder does actually exist, ADL causes 'ambiguous call' errors whenever a standard library type like std::pair is laundered within the folly namespace. (This breaks compilation of folly's futures, for example, and I believe it will cause compilation issues anywhere else F14Map is used, since it launders std::pair in its F14Policy.)
Pull Request resolved: https://github.com/facebook/folly/pull/948

Reviewed By: ot

Differential Revision: D10287027

Pulled By: yfeldblum

fbshipit-source-id: be3469fe6855d2af266e1b6a62968770e8cfd76f
parent 0731f1ad
......@@ -26,7 +26,9 @@
* * std::launder
*/
#if __cpp_lib_launder >= 201606 || (_MSC_VER && _HAS_LAUNDER)
// Note: libc++ 6+ adds std::launder but does not define __cpp_lib_launder
#if __cpp_lib_launder >= 201606 || (_MSC_VER && _HAS_LAUNDER) || \
(_LIBCPP_VERSION >= 6000 && __cplusplus >= 201703L)
namespace folly {
......
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