[libcxx] Fix detection of __is_final.
Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8795
llvm-svn: 239664
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: ee187e247bc2c7b97eb345e1de7f5ccf151e24e5
diff --git a/include/map b/include/map
index 4c79662..14eb4eb 100644
--- a/include/map
+++ b/include/map
@@ -428,6 +428,7 @@
#include <utility>
#include <functional>
#include <initializer_list>
+#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -435,10 +436,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _CP, class _Compare, bool = is_empty<_Compare>::value
-#if __has_feature(is_final)
- && !__is_final(_Compare)
-#endif
+template <class _Key, class _CP, class _Compare,
+ bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value
>
class __map_value_compare
: private _Compare