Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -68,6 +68,9 @@ #define _LIBCPP_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) +#if __cplusplus < 201103L +#define _LIBCPP_CXX03_LANG +#endif #ifndef __has_attribute #define __has_attribute(__x) 0 @@ -229,10 +232,6 @@ # define _ALIGNAS(x) __attribute__((__aligned__(x))) #endif -#if !__has_feature(cxx_alias_templates) -#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES -#endif - #if __cplusplus < 201103L typedef __char16_t char16_t; typedef __char32_t char32_t; @@ -260,10 +259,6 @@ # define _LIBCPP_NORETURN __attribute__ ((noreturn)) #endif -#if !(__has_feature(cxx_default_function_template_args)) -#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS -#endif - #if !(__has_feature(cxx_defaulted_functions)) #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #endif // !(__has_feature(cxx_defaulted_functions)) @@ -284,26 +279,14 @@ #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif -#if !(__has_feature(cxx_static_assert)) -#define _LIBCPP_HAS_NO_STATIC_ASSERT -#endif - #if !(__has_feature(cxx_auto_type)) #define _LIBCPP_HAS_NO_AUTO_TYPE #endif -#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return) -#define _LIBCPP_HAS_NO_ADVANCED_SFINAE -#endif - #if !(__has_feature(cxx_variadic_templates)) #define _LIBCPP_HAS_NO_VARIADICS #endif -#if !(__has_feature(cxx_trailing_return)) -#define _LIBCPP_HAS_NO_TRAILING_RETURN -#endif - #if !(__has_feature(cxx_generalized_initializers)) #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif @@ -428,34 +411,26 @@ #endif #ifndef __GXX_EXPERIMENTAL_CXX0X__ - -#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_DECLTYPE -#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_NULLPTR -#define _LIBCPP_HAS_NO_STATIC_ASSERT #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_STRONG_ENUMS -#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_NOEXCEPT #else // __GXX_EXPERIMENTAL_CXX0X__ #if _GNUC_VER < 403 -#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS #define _LIBCPP_HAS_NO_RVALUE_REFERENCES -#define _LIBCPP_HAS_NO_STATIC_ASSERT #endif #if _GNUC_VER < 404 #define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS -#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS @@ -464,11 +439,9 @@ #if _GNUC_VER < 406 #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR -#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif #if _GNUC_VER < 407 -#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #endif @@ -490,7 +463,6 @@ #elif defined(_LIBCPP_MSVC) -#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CXX14_CONSTEXPR #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES @@ -520,9 +492,6 @@ #define _ATTRIBUTE(x) __attribute__((x)) #define _LIBCPP_NORETURN __attribute__((noreturn)) -#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS -#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES -#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_NOEXCEPT #define _LIBCPP_HAS_NO_NULLPTR @@ -677,8 +646,10 @@ #define _LIBCPP_HAS_NO_INT128 #endif -#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT - +#ifdef _LIBCPP_CXX03_LANG +# if __has_extension(c_static_assert) +# define static_assert(__b, __m) _Static_assert(__b, __m) +# else extern "C++" { template <bool> struct __static_assert_test; template <> struct __static_assert_test<true> {}; @@ -687,8 +658,8 @@ #define static_assert(__b, __m) \ typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \ _LIBCPP_CONCAT(__t, __LINE__) - -#endif // _LIBCPP_HAS_NO_STATIC_ASSERT +# endif // __has_extension(c_static_assert) +#endif // _LIBCPP_CXX03_LANG #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. @@ -934,14 +905,6 @@ #define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK #endif -#if __cplusplus < 201103L -#define _LIBCPP_CXX03_LANG -#else -#if defined(_LIBCPP_HAS_NO_VARIADIC_TEMPLATES) || defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) -#error Libc++ requires a feature complete C++11 compiler in C++11 or greater. -#endif -#endif - #if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \ && __has_attribute(acquire_capability)) #define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS Index: include/iterator =================================================================== --- include/iterator +++ include/iterator @@ -1566,7 +1566,7 @@ return __array + _Np; } -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#if !defined(_LIBCPP_CXX03_LANG) template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY @@ -1689,7 +1689,7 @@ #endif -#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#else // defined(_LIBCPP_CXX03_LANG) template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY @@ -1723,7 +1723,7 @@ return __c.end(); } -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#endif // !defined(_LIBCPP_CXX03_LANG) #if _LIBCPP_STD_VER > 14 template <class _Cont> Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -828,7 +828,7 @@ template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value> struct __pointer_traits_rebind { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Tp::template rebind<_Up> type; #else typedef typename _Tp::template rebind<_Up>::other type; @@ -840,7 +840,7 @@ template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _Args...>::template rebind<_Up> type; #else typedef typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type; @@ -858,7 +858,7 @@ template <template <class> class _Sp, class _Tp, class _Up> struct __pointer_traits_rebind<_Sp<_Tp>, _Up, true> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp>::template rebind<_Up> type; #else typedef typename _Sp<_Tp>::template rebind<_Up>::other type; @@ -874,7 +874,7 @@ template <template <class, class> class _Sp, class _Tp, class _A0, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _A0>, _Up, true> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0>::template rebind<_Up> type; #else typedef typename _Sp<_Tp, _A0>::template rebind<_Up>::other type; @@ -891,7 +891,7 @@ class _A1, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1>, _Up, true> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up> type; #else typedef typename _Sp<_Tp, _A0, _A1>::template rebind<_Up>::other type; @@ -909,7 +909,7 @@ class _A1, class _A2, class _Up> struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, true> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up> type; #else typedef typename _Sp<_Tp, _A0, _A1, _A2>::template rebind<_Up>::other type; @@ -932,12 +932,12 @@ typedef typename __pointer_traits_element_type<pointer>::type element_type; typedef typename __pointer_traits_difference_type<pointer>::type difference_type; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type; #else template <class _Up> struct rebind {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG private: struct __nat {}; @@ -955,7 +955,7 @@ typedef _Tp element_type; typedef ptrdiff_t difference_type; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _Up> using rebind = _Up*; #else template <class _Up> struct rebind {typedef _Up* other;}; @@ -972,7 +972,7 @@ template <class _From, class _To> struct __rebind_pointer { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_From>::template rebind<_To> type; #else typedef typename pointer_traits<_From>::template rebind<_To>::other type; @@ -1036,7 +1036,7 @@ template <class _Tp, class _Ptr, class _Alloc> struct __const_pointer<_Tp, _Ptr, _Alloc, false> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<const _Tp> type; #else typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type; @@ -1063,7 +1063,7 @@ template <class _Ptr, class _Alloc> struct __void_pointer<_Ptr, _Alloc, false> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<void> type; #else typedef typename pointer_traits<_Ptr>::template rebind<void>::other type; @@ -1090,7 +1090,7 @@ template <class _Ptr, class _Alloc> struct __const_void_pointer<_Ptr, _Alloc, false> { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename pointer_traits<_Ptr>::template rebind<const void> type; #else typedef typename pointer_traits<_Ptr>::template rebind<const void>::other type; @@ -1321,7 +1321,7 @@ #endif // _LIBCPP_HAS_NO_VARIADICS -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#ifndef _LIBCPP_CXX03_LANG template <class _Alloc, class _SizeType, class _ConstVoidPtr> auto @@ -1344,7 +1344,7 @@ { }; -#else // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#else // _LIBCPP_CXX03_LANG template <class _Alloc, class _SizeType, class _ConstVoidPtr> struct __has_allocate_hint @@ -1352,9 +1352,9 @@ { }; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif // _LIBCPP_CXX03_LANG -#if !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) && !defined(_LIBCPP_HAS_NO_VARIADICS) +#if !defined(_LIBCPP_CXX03_LANG) template <class _Alloc, class _Tp, class ..._Args> decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Tp*>(), @@ -1435,7 +1435,7 @@ { }; -#else // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#else // _LIBCPP_CXX03_LANG #ifndef _LIBCPP_HAS_NO_VARIADICS @@ -1473,7 +1473,7 @@ { }; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif // _LIBCPP_CXX03_LANG template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value> struct __alloc_traits_difference_type @@ -1510,16 +1510,16 @@ typedef typename __is_always_equal<allocator_type>::type is_always_equal; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> using rebind_alloc = typename __allocator_traits_rebind<allocator_type, _Tp>::type; template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>; -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else // _LIBCPP_CXX03_LANG template <class _Tp> struct rebind_alloc {typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;}; template <class _Tp> struct rebind_traits {typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY static pointer allocate(allocator_type& __a, size_type __n) @@ -1731,7 +1731,7 @@ template <class _Traits, class _Tp> struct __rebind_alloc_helper { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG typedef typename _Traits::template rebind_alloc<_Tp> type; #else typedef typename _Traits::template rebind_alloc<_Tp>::other type; Index: include/ratio =================================================================== --- include/ratio +++ include/ratio @@ -300,18 +300,18 @@ >::type type; }; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _R1, class _R2> using ratio_multiply = typename __ratio_multiply<_R1, _R2>::type; -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply : public __ratio_multiply<_R1, _R2>::type {}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct __ratio_divide @@ -327,18 +327,18 @@ >::type type; }; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _R1, class _R2> using ratio_divide = typename __ratio_divide<_R1, _R2>::type; -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct _LIBCPP_TYPE_VIS_ONLY ratio_divide : public __ratio_divide<_R1, _R2>::type {}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct __ratio_add @@ -362,18 +362,18 @@ >::type type; }; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _R1, class _R2> using ratio_add = typename __ratio_add<_R1, _R2>::type; -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct _LIBCPP_TYPE_VIS_ONLY ratio_add : public __ratio_add<_R1, _R2>::type {}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct __ratio_subtract @@ -397,18 +397,18 @@ >::type type; }; -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#ifndef _LIBCPP_CXX03_LANG template <class _R1, class _R2> using ratio_subtract = typename __ratio_subtract<_R1, _R2>::type; -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else // _LIBCPP_CXX03_LANG template <class _R1, class _R2> struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract : public __ratio_subtract<_R1, _R2>::type {}; -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif // _LIBCPP_CXX03_LANG // ratio_equal Index: include/scoped_allocator =================================================================== --- include/scoped_allocator +++ include/scoped_allocator @@ -115,7 +115,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) +#if !defined(_LIBCPP_CXX03_LANG) // scoped_allocator_adaptor @@ -597,7 +597,7 @@ return !(__a == __b); } -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) +#endif // !defined(_LIBCPP_CXX03_LANG) _LIBCPP_END_NAMESPACE_STD Index: include/type_traits =================================================================== --- include/type_traits +++ include/type_traits @@ -4351,7 +4351,7 @@ template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#ifndef _LIBCPP_CXX03_LANG typename enable_if < is_move_constructible<_Tp>::value && @@ -4559,7 +4559,7 @@ typename __sfinae_underlying_type<_Tp>::__promoted_type __convert_to_integral(_Tp __val) { return __val; } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#ifndef _LIBCPP_CXX03_LANG template <class _Tp> struct __has_operator_addressof_member_imp @@ -4591,7 +4591,7 @@ || __has_operator_addressof_free_imp<_Tp>::value> {}; -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template <class...> using void_t = void; Index: test/std/containers/associative/map/map.cons/copy.pass.cpp =================================================================== --- test/std/containers/associative/map/map.cons/copy.pass.cpp +++ test/std/containers/associative/map/map.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <map> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" #include "min_allocator.h" @@ -56,7 +57,7 @@ assert(*next(mo.begin()) == V(2, 1)); assert(*next(mo.begin(), 2) == V(3, 1)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = @@ -91,8 +92,6 @@ assert(*next(mo.begin()) == V(2, 1)); assert(*next(mo.begin(), 2) == V(3, 1)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = Index: test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp =================================================================== --- test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp +++ test/std/containers/associative/multimap/multimap.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <map> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" #include "min_allocator.h" @@ -47,7 +48,7 @@ assert(mo.get_allocator() == A(7)); assert(mo.key_comp() == C(5)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = @@ -73,8 +74,6 @@ assert(mo.get_allocator() == A(7)); assert(mo.key_comp() == C(5)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::pair<const int, double> V; V ar[] = Index: test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp =================================================================== --- test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp +++ test/std/containers/associative/multiset/multiset.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <set> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" @@ -67,7 +68,7 @@ assert(*next(mo.begin(), 7) == 3); assert(*next(mo.begin(), 8) == 3); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -114,5 +115,5 @@ assert(*next(mo.begin(), 7) == 3); assert(*next(mo.begin(), 8) == 3); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } Index: test/std/containers/associative/set/set.cons/copy.pass.cpp =================================================================== --- test/std/containers/associative/set/set.cons/copy.pass.cpp +++ test/std/containers/associative/set/set.cons/copy.pass.cpp @@ -16,6 +16,7 @@ #include <set> #include <cassert> +#include "test_macros.h" #include "../../../test_compare.h" #include "test_allocator.h" @@ -55,7 +56,7 @@ assert(*next(mo.begin()) == 2); assert(*next(mo.begin(), 2) == 3); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int V; V ar[] = @@ -90,5 +91,5 @@ assert(*next(mo.begin()) == 2); assert(*next(mo.begin(), 2) == 3); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } Index: test/std/containers/sequences/deque/deque.cons/copy.pass.cpp =================================================================== --- test/std/containers/sequences/deque/deque.cons/copy.pass.cpp +++ test/std/containers/sequences/deque/deque.cons/copy.pass.cpp @@ -13,6 +13,8 @@ #include <deque> #include <cassert> + +#include "test_macros.h" #include "test_allocator.h" #include "min_allocator.h" @@ -37,15 +39,13 @@ assert(v2 == v); assert(v2.get_allocator() == v.get_allocator()); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { std::deque<int, other_allocator<int> > v(3, 2, other_allocator<int>(5)); std::deque<int, other_allocator<int> > v2 = v; assert(v2 == v); assert(v2.get_allocator() == other_allocator<int>(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { int ab[] = {3, 4, 2, 8, 0, 1, 44, 34, 45, 96, 80, 1, 13, 31, 45}; int* an = ab + sizeof(ab)/sizeof(ab[0]); Index: test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp =================================================================== --- test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp +++ test/std/containers/sequences/forwardlist/forwardlist.cons/copy.pass.cpp @@ -15,6 +15,7 @@ #include <cassert> #include <iterator> +#include "test_macros.h" #include "test_allocator.h" #include "min_allocator.h" @@ -34,7 +35,7 @@ assert(c == c0); assert(c.get_allocator() == A(10)); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef int T; typedef other_allocator<int> A; @@ -49,8 +50,6 @@ assert(c == c0); assert(c.get_allocator() == A(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef int T; typedef min_allocator<int> A; Index: test/std/containers/sequences/list/list.cons/copy.pass.cpp =================================================================== --- test/std/containers/sequences/list/list.cons/copy.pass.cpp +++ test/std/containers/sequences/list/list.cons/copy.pass.cpp @@ -13,6 +13,8 @@ #include <list> #include <cassert> + +#include "test_macros.h" #include "DefaultOnly.h" #include "test_allocator.h" #include "min_allocator.h" @@ -30,15 +32,13 @@ assert(l2 == l); assert(l2.get_allocator() == l.get_allocator()); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { std::list<int, other_allocator<int> > l(3, 2, other_allocator<int>(5)); std::list<int, other_allocator<int> > l2 = l; assert(l2 == l); assert(l2.get_allocator() == other_allocator<int>(-2)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { std::list<int, min_allocator<int>> l(3, 2); std::list<int, min_allocator<int>> l2 = l; Index: test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.map/unord.map.cnstr/copy.pass.cpp @@ -68,7 +68,7 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, @@ -108,8 +108,6 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_map<int, std::string, test_hash<std::hash<int> >, Index: test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.multimap/unord.multimap.cnstr/copy.pass.cpp @@ -82,7 +82,7 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, @@ -136,8 +136,6 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, Index: test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.multiset/unord.multiset.cnstr/copy.pass.cpp @@ -74,7 +74,7 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, @@ -121,8 +121,6 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_multiset<int, test_hash<std::hash<int> >, Index: test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp =================================================================== --- test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp +++ test/std/containers/unord/unord.set/unord.set.cnstr/copy.pass.cpp @@ -66,7 +66,7 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, @@ -105,8 +105,6 @@ assert(std::fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE -#if TEST_STD_VER >= 11 { typedef std::unordered_set<int, test_hash<std::hash<int> >, Index: test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp +++ test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_hint.pass.cpp @@ -20,6 +20,8 @@ #include <cstdint> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -52,10 +54,10 @@ int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 A<int> a; assert(std::allocator_traits<A<int> >::allocate(a, 10, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xDEADBEEF))); -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif B<int> b; assert(std::allocator_traits<B<int> >::allocate(b, 11, nullptr) == reinterpret_cast<int*>(static_cast<std::uintptr_t>(0xFEADBEEF))); } Index: test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp +++ test/std/utilities/memory/allocator.traits/allocator.traits.members/construct.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -36,14 +38,14 @@ { typedef T value_type; -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 template <class U, class ...Args> void construct(U* p, Args&& ...args) { ++b_construct; ::new ((void*)p) U(std::forward<Args>(args)...); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif }; struct A0 @@ -105,7 +107,7 @@ std::allocator_traits<A<int> >::construct(a, (A2*)&a2, 'd', 5); assert(A2::count == 1); } -#ifndef _LIBCPP_HAS_NO_VARIADICS +#if TEST_STD_VER >= 11 { A0::count = 0; b_construct = 0; @@ -139,5 +141,5 @@ assert(A2::count == 1); assert(b_construct == 1); } -#endif // _LIBCPP_HAS_NO_VARIADICS +#endif } Index: test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp +++ test/std/utilities/memory/allocator.traits/allocator.traits.members/destroy.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -63,7 +65,7 @@ std::allocator_traits<A<int> >::destroy(a, (A0*)&a0); assert(A0::count == 1); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { A0::count = 0; b_destroy = 0; @@ -76,5 +78,5 @@ assert(A0::count == 1); assert(b_destroy == 1); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } Index: test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp +++ test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp @@ -43,7 +43,15 @@ int main() { -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE + { + B<int> b; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } + { + const B<int> b = {}; + assert(std::allocator_traits<B<int> >::max_size(b) == 100); + } +#if TEST_STD_VER >= 11 { A<int> a; assert(std::allocator_traits<A<int> >::max_size(a) == @@ -54,16 +62,6 @@ assert(std::allocator_traits<A<int> >::max_size(a) == std::numeric_limits<std::size_t>::max() / sizeof(int)); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE - { - B<int> b; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } - { - const B<int> b = {}; - assert(std::allocator_traits<B<int> >::max_size(b) == 100); - } -#if TEST_STD_VER >= 11 { std::allocator<int> a; static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, ""); Index: test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp +++ test/std/utilities/memory/allocator.traits/allocator.traits.members/select_on_container_copy_construction.pass.cpp @@ -22,6 +22,8 @@ #include <type_traits> #include <cassert> +#include "test_macros.h" + template <class T> struct A { @@ -55,7 +57,7 @@ const A<int> a(0); assert(std::allocator_traits<A<int> >::select_on_container_copy_construction(a).id == 0); } -#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER >= 11 { B<int> b; assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); @@ -64,5 +66,5 @@ const B<int> b(0); assert(std::allocator_traits<B<int> >::select_on_container_copy_construction(b).id == 100); } -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif } Index: test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp =================================================================== --- test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp +++ test/std/utilities/memory/allocator.traits/rebind_traits.pass.cpp @@ -19,6 +19,8 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + template <class T> struct ReboundA {}; @@ -63,17 +65,17 @@ int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>, std::allocator_traits<E<double> > >::value), ""); -#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#else static_assert((std::is_same<std::allocator_traits<A<char> >::rebind_traits<double>::other, std::allocator_traits<ReboundA<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<B<int, char> >::rebind_traits<double>::other, std::allocator_traits<ReboundB<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<C<char> >::rebind_traits<double>::other, std::allocator_traits<C<double> > >::value), ""); static_assert((std::is_same<std::allocator_traits<D<int, char> >::rebind_traits<double>::other, std::allocator_traits<D<double, char> > >::value), ""); static_assert((std::is_same<std::allocator_traits<E<char> >::rebind_traits<double>::other, std::allocator_traits<E<double> > >::value), ""); -#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#endif } Index: test/std/utilities/memory/pointer.traits/rebind.pass.cpp =================================================================== --- test/std/utilities/memory/pointer.traits/rebind.pass.cpp +++ test/std/utilities/memory/pointer.traits/rebind.pass.cpp @@ -19,9 +19,11 @@ #include <memory> #include <type_traits> +#include "test_macros.h" + int main() { -#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES +#if TEST_STD_VER >= 11 static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>, double*>::value), ""); #else static_assert((std::is_same<std::pointer_traits<int*>::rebind<double>::other, double*>::value), ""); Index: test/support/test_allocator.h =================================================================== --- test/support/test_allocator.h +++ test/support/test_allocator.h @@ -66,7 +66,7 @@ { assert(data_ >= 0); if (time_to_throw >= throw_after) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef TEST_HAS_NO_EXCEPTIONS throw std::bad_alloc(); #else std::terminate(); @@ -130,7 +130,7 @@ { assert(data_ >= 0); if (time_to_throw >= throw_after) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef TEST_HAS_NO_EXCEPTIONS throw std::bad_alloc(); #else std::terminate(); @@ -221,10 +221,10 @@ typedef std::true_type propagate_on_container_move_assignment; typedef std::true_type propagate_on_container_swap; -#ifdef _LIBCPP_HAS_NO_ADVANCED_SFINAE +#if TEST_STD_VER < 11 std::size_t max_size() const {return UINT_MAX / sizeof(T);} -#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE +#endif };