Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -75,10 +75,8 @@ #ifdef _WIN32 # define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 0 -// Compiler intrinsics (GCC or MSVC) -# if defined(__clang__) \ - || (defined(_MSC_VER) && _MSC_VER >= 1400) \ - || (defined(__GNUC__) && _GNUC_VER > 403) +// Compiler intrinsics (MSVC) +#if defined(_MSC_VER) && _MSC_VER >= 1400 # define _LIBCPP_HAS_IS_BASE_OF # endif # if defined(_MSC_VER) && !defined(__clang__) @@ -93,12 +91,6 @@ # endif #endif // _WIN32 -#ifdef __linux__ -# if defined(__GNUC__) && _GNUC_VER >= 403 -# define _LIBCPP_HAS_IS_BASE_OF -# endif -#endif - #ifdef __sun__ # include # ifdef _LITTLE_ENDIAN @@ -318,6 +310,10 @@ # define _LIBCPP_HAS_IS_BASE_OF #endif +#if __has_feature(is_final) +# define _LIBCPP_HAS_IS_FINAL +#endif + // Objective-C++ features (opt-in) #if __has_feature(objc_arc) #define _LIBCPP_HAS_OBJC_ARC @@ -401,6 +397,11 @@ #if _GNUC_VER >= 407 #define _LIBCPP_UNDERLYING_TYPE(T) __underlying_type(T) #define _LIBCPP_IS_LITERAL(T) __is_literal_type(T) +#define _LIBCPP_HAS_IS_FINAL +#endif + +#if defined(__GNUC__) && _GNUC_VER >= 403 +# define _LIBCPP_HAS_IS_BASE_OF #endif #if !__EXCEPTIONS @@ -535,6 +536,7 @@ #define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_IS_BASE_OF +#define _LIBCPP_HAS_IS_FINAL #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #if defined(_AIX) Index: include/exception =================================================================== --- include/exception +++ include/exception @@ -193,8 +193,8 @@ throw_with_nested(_Tp&& __t, typename enable_if< is_class::type>::value && !is_base_of::type>::value -#if _LIBCPP_STD_VER > 11 - && !is_final::type>::value +#if defined(_LIBCPP_HAS_IS_FINAL) + && !__is_final(typename remove_reference<_Tp>::type) #endif >::type* = 0) #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES @@ -215,8 +215,8 @@ throw_with_nested(_Tp&& __t, typename enable_if< !is_class::type>::value || is_base_of::type>::value -#if _LIBCPP_STD_VER > 11 - || is_final::type>::value +#if defined(_LIBCPP_HAS_IS_FINAL) + || __is_final(typename remove_reference<_Tp>::type) #endif >::type* = 0) #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES Index: include/ext/hash_map =================================================================== --- include/ext/hash_map +++ include/ext/hash_map @@ -220,7 +220,7 @@ using namespace std; template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Hash) #endif > @@ -256,7 +256,7 @@ }; template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Pred) #endif > Index: include/map =================================================================== --- include/map +++ include/map @@ -434,7 +434,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Compare) #endif > Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -1934,12 +1934,12 @@ template ::type, typename remove_cv<_T2>::type>::value, bool = is_empty<_T1>::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_T1) #endif , bool = is_empty<_T2>::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_T2) #endif > Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -162,7 +162,7 @@ // __tuple_leaf template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Hp) #endif > Index: include/type_traits =================================================================== --- include/type_traits +++ include/type_traits @@ -796,8 +796,8 @@ // is_final -#if _LIBCPP_STD_VER > 11 && __has_feature(is_final) -template struct _LIBCPP_TYPE_VIS_ONLY +#if _LIBCPP_STD_VER > 11 && defined(_LIBCPP_HAS_IS_FINAL) +template struct _LIBCPP_TYPE_VIS_ONLY is_final : public integral_constant {}; #endif Index: include/unordered_map =================================================================== --- include/unordered_map +++ include/unordered_map @@ -360,7 +360,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Hash) #endif > @@ -411,7 +411,7 @@ }; template ::value -#if __has_feature(is_final) +#if defined(_LIBCPP_HAS_IS_FINAL) && !__is_final(_Pred) #endif >