diff --git a/include/__config b/include/__config index d8b0a99a..bb4e72ee 100644 --- a/include/__config +++ b/include/__config @@ -144,6 +144,10 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_VARIADICS #endif +#if !(__has_feature(cxx_trailing_return)) +#define _LIBCPP_HAS_NO_TRAILING_RETURN +#endif + #if __has_feature(cxx_inline_namespaces) #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_END_NAMESPACE_STD } } @@ -190,6 +194,8 @@ using namespace _LIBCPP_NAMESPACE; #else // __GXX_EXPERIMENTAL_CXX0X__ +#define _LIBCPP_HAS_NO_TRAILING_RETURN + #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) #define _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif diff --git a/include/cmath b/include/cmath index 8b7f2cf2..4d92841e 100644 --- a/include/cmath +++ b/include/cmath @@ -297,12 +297,6 @@ long double truncl(long double x); */ -// FIXME: work around for Clang with -std=C++0x on OSX/iOS -#if defined(__clang__) && defined(__APPLE__) -# pragma push_macro("__STRICT_ANSI__") -# undef __STRICT_ANSI__ -#endif // defined(__clang__) && defined(__APPLE__) - #include <__config> #include #include @@ -1587,9 +1581,4 @@ using ::truncl; _LIBCPP_END_NAMESPACE_STD -// FIXME: work around for Clang with -std=C++0x on OSX/iOS -#if defined(__clang__) && defined(__APPLE__) -# pragma pop_macro("__STRICT_ANSI__") -#endif - #endif // _LIBCPP_CMATH diff --git a/include/cstddef b/include/cstddef index def48bcd..33886d42 100644 --- a/include/cstddef +++ b/include/cstddef @@ -78,42 +78,6 @@ struct _LIBCPP_VISIBLE nullptr_t friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;} - - template - friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;} }; inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);} diff --git a/include/iterator b/include/iterator index f1a4f9c9..7001c35c 100644 --- a/include/iterator +++ b/include/iterator @@ -1616,7 +1616,7 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n, #endif // _LIBCPP_DEBUG -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE) +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) template inline _LIBCPP_INLINE_VISIBILITY @@ -1650,7 +1650,7 @@ end(const _C& __c) -> decltype(__c.end()) return __c.end(); } -#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE) +#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) template inline _LIBCPP_INLINE_VISIBILITY @@ -1684,7 +1684,7 @@ end(const _C& __c) return __c.end(); } -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE) +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) template inline _LIBCPP_INLINE_VISIBILITY diff --git a/include/memory b/include/memory index 86da7215..c0161546 100644 --- a/include/memory +++ b/include/memory @@ -1471,7 +1471,7 @@ struct _LIBCPP_VISIBLE uses_allocator { }; -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) // uses-allocator construction @@ -1489,7 +1489,7 @@ struct __uses_alloc_ctor : integral_constant::value> {}; -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE) +#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) // allocator diff --git a/include/thread b/include/thread index 7b6cf932..a4d3c4cc 100644 --- a/include/thread +++ b/include/thread @@ -253,13 +253,8 @@ class _LIBCPP_VISIBLE thread { pthread_t __t_; -#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS - thread(const thread&) = delete; - thread& operator=(const thread&) = delete; -#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS thread(const thread&); thread& operator=(const thread&); -#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS public: typedef __thread_id id; typedef pthread_t native_handle_type; diff --git a/include/type_traits b/include/type_traits index 82d1f91b..d3318cdc 100644 --- a/include/type_traits +++ b/include/type_traits @@ -1254,9 +1254,8 @@ private: static _Tp __t(); static _Up __u(); #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES - static bool __f(); public: - typedef decltype(__f() ? __t() : __u()) type; + typedef decltype(true ? __t() : __u()) type; }; #else // _LIBCPP_HAS_NO_VARIADICS @@ -1335,11 +1334,10 @@ inline _LIBCPP_INLINE_VISIBILITY typename remove_reference<_Tp>::type&& move(_Tp&& __t) { - return static_cast::type&&>(__t); + typedef typename remove_reference<_Tp>::type _Up; + return static_cast<_Up&&>(__t); } -#if 1 - template inline _LIBCPP_INLINE_VISIBILITY _Tp&& @@ -1358,54 +1356,6 @@ forward(typename std::remove_reference<_Tp>::type&& __t) return static_cast<_Tp&&>(__t); } -#else - -template ::value - >::type - > -inline _LIBCPP_INLINE_VISIBILITY -_Tp&& -forward(typename common_type<_Tp>::type& __t) -{ - return static_cast<_Tp&&>(__t); -} - -template ::value - >::type - > -inline _LIBCPP_INLINE_VISIBILITY -_Tp&& -forward(typename common_type<_Tp>::type&& __t) -{ - return static_cast<_Tp&&>(__t); -} - -template ::value - >::type - > -inline _LIBCPP_INLINE_VISIBILITY -_Tp -forward(typename common_type<_Tp>::type __t) -{ - return __t; -} - -template ::value - >::type - > -_Tp -forward(typename remove_reference<_Tp>::type&& __t) = delete; - -#endif - #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template diff --git a/include/utility b/include/utility index 1c1e4a39..3a6847a2 100644 --- a/include/utility +++ b/include/utility @@ -218,8 +218,6 @@ struct _LIBCPP_VISIBLE pair second(_STD::forward<_U2>(__u2)) {} -#ifndef _LIBCPP_HAS_NO_VARIADICS - template::value>::type> _LIBCPP_INLINE_VISIBILITY @@ -230,6 +228,8 @@ struct _LIBCPP_VISIBLE pair typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p))) {} +#ifndef _LIBCPP_HAS_NO_VARIADICS + template _LIBCPP_INLINE_VISIBILITY pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, @@ -239,6 +239,8 @@ struct _LIBCPP_VISIBLE pair typename __make_tuple_indices::type()) {} +#endif // _LIBCPP_HAS_NO_VARIADICS + template ::value>::type> _LIBCPP_INLINE_VISIBILITY @@ -253,8 +255,6 @@ struct _LIBCPP_VISIBLE pair return *this; } -#endif // _LIBCPP_HAS_NO_VARIADICS - #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES template _LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p) diff --git a/test/language.support/support.types/nullptr_t.pass.cpp b/test/language.support/support.types/nullptr_t.pass.cpp index e1cbfe39..b169f1a7 100644 --- a/test/language.support/support.types/nullptr_t.pass.cpp +++ b/test/language.support/support.types/nullptr_t.pass.cpp @@ -24,12 +24,11 @@ int main() "sizeof(std::nullptr_t) == sizeof(void*)"); A* p = 0; assert(p == nullptr); - assert(nullptr == p); -#if !((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)) - // GCC 4.2 through 4.5 can't handle this void (A::*pmf)() = 0; +#ifdef __clang__ + // GCC 4.2 can't handle this assert(pmf == nullptr); -#endif // !((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)) +#endif int A::*pmd = 0; assert(pmd == nullptr); A a1(nullptr); @@ -42,20 +41,4 @@ int main() assert(!(nullptr != nullptr)); assert(!(nullptr < nullptr)); assert(!(nullptr > nullptr)); - assert(!(&a1 == nullptr)); - assert(!(nullptr == &a1)); - assert(&a1 != nullptr); - assert(nullptr != &a1); - assert(nullptr < &a1); - assert(nullptr <= &a1); - assert(!(nullptr < p)); - assert(nullptr <= p); - assert(!(&a1 < nullptr)); - assert(!(&a1 <= nullptr)); - assert(!(p < nullptr)); - assert(p <= nullptr); - assert(!(nullptr > &a1)); - assert(!(nullptr >= &a1)); - assert(!(nullptr > p)); - assert(nullptr >= p); }