diff options
author | François Dumont <fdumont@gcc.gnu.org> | 2013-04-07 10:42:51 +0000 |
---|---|---|
committer | François Dumont <fdumont@gcc.gnu.org> | 2013-04-07 10:42:51 +0000 |
commit | 82b12c4b24d52b38cc4d538cc0e978002ead07e2 (patch) | |
tree | 8a4678040213a110aad7bd8b03bd29315fb64ac7 | |
parent | 7c42966e8533afa8a5102e4fd072c825d57fea2e (diff) | |
download | gcc-82b12c4b24d52b38cc4d538cc0e978002ead07e2.zip gcc-82b12c4b24d52b38cc4d538cc0e978002ead07e2.tar.gz gcc-82b12c4b24d52b38cc4d538cc0e978002ead07e2.tar.bz2 |
functional (_Derives_from_unary_function): Remove.
2013-04-04 François Dumont <fdumont@gcc.gnu.org>
* include/std/functional (_Derives_from_unary_function): Remove.
(_Derives_from_binary_function): Remove.
* include/std/type_traits (__sfinae_types): Remove.
(__is_assignable_helper): Adapt.
(__is_convertible_helper): Adapt.
(_GLIBCXX_HAS_NESTED_TYPE): Adapt.
Remove several explicit instantiations of integral_constant.
* testsuite/20_util/reference_wrapper/typedefs-3.cc: Adapt.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
Adapt dg-error line number.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
Likewise.
* testsuite/20_util/declval/requirements/1_neg.cc: Likewise.
* testsuite/20_util/bind/ref_neg.cc: Likewise.
From-SVN: r197551
8 files changed, 84 insertions, 113 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index bbd285c..64e5383 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,20 @@ +2013-04-07 François Dumont <fdumont@gcc.gnu.org> + + * include/std/functional (_Derives_from_unary_function): Remove. + (_Derives_from_binary_function): Remove. + * include/std/type_traits (__sfinae_types): Remove. + (__is_assignable_helper): Adapt. + (__is_convertible_helper): Adapt. + (_GLIBCXX_HAS_NESTED_TYPE): Adapt. + Remove several explicit instantiations of integral_constant. + * testsuite/20_util/reference_wrapper/typedefs-3.cc: Adapt. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: + Adapt dg-error line number. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: + Likewise. + * testsuite/20_util/declval/requirements/1_neg.cc: Likewise. + * testsuite/20_util/bind/ref_neg.cc: Likewise. + 2013-04-05 Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/56841 diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional index 714b3ed..44d3fd5 100644 --- a/libstdc++-v3/include/std/functional +++ b/libstdc++-v3/include/std/functional @@ -185,38 +185,6 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type) : _Weak_result_type_impl<typename remove_cv<_Functor>::type> { }; - /// Determines if the type _Tp derives from unary_function. - template<typename _Tp> - struct _Derives_from_unary_function : __sfinae_types - { - private: - template<typename _T1, typename _Res> - static __one __test(const volatile unary_function<_T1, _Res>*); - - // It's tempting to change "..." to const volatile void*, but - // that fails when _Tp is a function type. - static __two __test(...); - - public: - static const bool value = sizeof(__test((_Tp*)0)) == 1; - }; - - /// Determines if the type _Tp derives from binary_function. - template<typename _Tp> - struct _Derives_from_binary_function : __sfinae_types - { - private: - template<typename _T1, typename _T2, typename _Res> - static __one __test(const volatile binary_function<_T1, _T2, _Res>*); - - // It's tempting to change "..." to const volatile void*, but - // that fails when _Tp is a function type. - static __two __test(...); - - public: - static const bool value = sizeof(__test((_Tp*)0)) == 1; - }; - /** * Invoke a function object, which may be either a member pointer or a * function object. The first parameter will tell which. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 334b8d0a..488ffd9 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -127,12 +127,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public integral_constant<bool, !_Pp::value> { }; - struct __sfinae_types - { - typedef char __one; - typedef struct { char __arr[2]; } __two; - }; - // For several sfinae-friendly trait implementations we transport both the // result information (as the member type) and the failure information (no // member type). This is very similar to std::enable_if, but we cannot use @@ -161,8 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_void template<typename _Tp> struct is_void - : public integral_constant<bool, (__is_void_helper<typename - remove_cv<_Tp>::type>::value)> + : public __is_void_helper<typename remove_cv<_Tp>::type>::type { }; template<typename> @@ -244,8 +237,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_integral template<typename _Tp> struct is_integral - : public integral_constant<bool, (__is_integral_helper<typename - remove_cv<_Tp>::type>::value)> + : public __is_integral_helper<typename remove_cv<_Tp>::type>::type { }; template<typename> @@ -273,8 +265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_floating_point template<typename _Tp> struct is_floating_point - : public integral_constant<bool, (__is_floating_point_helper<typename - remove_cv<_Tp>::type>::value)> + : public __is_floating_point_helper<typename remove_cv<_Tp>::type>::type { }; /// is_array @@ -301,8 +292,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_pointer template<typename _Tp> struct is_pointer - : public integral_constant<bool, (__is_pointer_helper<typename - remove_cv<_Tp>::type>::value)> + : public __is_pointer_helper<typename remove_cv<_Tp>::type>::type { }; /// is_lvalue_reference @@ -337,8 +327,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_member_object_pointer template<typename _Tp> struct is_member_object_pointer - : public integral_constant<bool, (__is_member_object_pointer_helper< - typename remove_cv<_Tp>::type>::value)> + : public __is_member_object_pointer_helper< + typename remove_cv<_Tp>::type>::type { }; template<typename> @@ -352,8 +342,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_member_function_pointer template<typename _Tp> struct is_member_function_pointer - : public integral_constant<bool, (__is_member_function_pointer_helper< - typename remove_cv<_Tp>::type>::value)> + : public __is_member_function_pointer_helper< + typename remove_cv<_Tp>::type>::type { }; /// is_enum @@ -422,8 +412,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // __is_nullptr_t (extension). template<typename _Tp> struct __is_nullptr_t - : public integral_constant<bool, (__is_nullptr_t_helper<typename - remove_cv<_Tp>::type>::value)> + : public __is_nullptr_t_helper<typename remove_cv<_Tp>::type>::type { }; // Composite type categories. @@ -480,8 +469,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_member_pointer template<typename _Tp> struct is_member_pointer - : public integral_constant<bool, (__is_member_pointer_helper< - typename remove_cv<_Tp>::type>::value)> + : public __is_member_pointer_helper<typename remove_cv<_Tp>::type>::type { }; // Type properties. @@ -567,7 +555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_signed template<typename _Tp> struct is_signed - : public integral_constant<bool, __is_signed_helper<_Tp>::value> + : public __is_signed_helper<_Tp>::type { }; /// is_unsigned @@ -650,7 +638,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_destructible template<typename _Tp> struct is_destructible - : public integral_constant<bool, (__is_destructible_safe<_Tp>::value)> + : public __is_destructible_safe<_Tp>::type { }; // is_nothrow_destructible requires that is_destructible is @@ -698,7 +686,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_nothrow_destructible template<typename _Tp> struct is_nothrow_destructible - : public integral_constant<bool, (__is_nt_destructible_safe<_Tp>::value)> + : public __is_nt_destructible_safe<_Tp>::type { }; struct __do_is_default_constructible_impl @@ -746,8 +734,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_default_constructible template<typename _Tp> struct is_default_constructible - : public integral_constant<bool, (__is_default_constructible_safe< - _Tp>::value)> + : public __is_default_constructible_safe<_Tp>::type { }; @@ -901,8 +888,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp, typename _Arg> struct __is_direct_constructible - : public integral_constant<bool, (__is_direct_constructible_new< - _Tp, _Arg>::value)> + : public __is_direct_constructible_new<_Tp, _Arg>::type { }; // Since default-construction and binary direct-initialization have @@ -953,8 +939,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// is_constructible template<typename _Tp, typename... _Args> struct is_constructible - : public integral_constant<bool, (__is_constructible_impl<_Tp, - _Args...>::value)> + : public __is_constructible_impl<_Tp, _Args...>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> @@ -1081,24 +1066,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp, typename _Up> class __is_assignable_helper - : public __sfinae_types { - template<typename _Tp1, typename _Up1> - static decltype(declval<_Tp1>() = declval<_Up1>(), __one()) + template<typename _Tp1, typename _Up1, + typename = decltype(declval<_Tp1>() = declval<_Up1>())> + static true_type __test(int); template<typename, typename> - static __two __test(...); + static false_type + __test(...); public: - static constexpr bool value = sizeof(__test<_Tp, _Up>(0)) == 1; + typedef decltype(__test<_Tp, _Up>(0)) type; }; /// is_assignable template<typename _Tp, typename _Up> struct is_assignable - : public integral_constant<bool, - __is_assignable_helper<_Tp, _Up>::value> + : public __is_assignable_helper<_Tp, _Up>::type { }; template<typename _Tp, bool = is_void<_Tp>::value> @@ -1292,31 +1277,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool = __or_<is_void<_From>, is_function<_To>, is_array<_To>>::value> struct __is_convertible_helper - { static constexpr bool value = is_void<_To>::value; }; + { typedef typename is_void<_To>::type type; }; template<typename _From, typename _To> class __is_convertible_helper<_From, _To, false> - : public __sfinae_types { - template<typename _To1> - static void __test_aux(_To1); + template<typename _To1> + static void __test_aux(_To1); - template<typename _From1, typename _To1> - static decltype(__test_aux<_To1>(std::declval<_From1>()), __one()) + template<typename _From1, typename _To1, + typename = decltype(__test_aux<_To1>(std::declval<_From1>()))> + static true_type __test(int); template<typename, typename> - static __two __test(...); + static false_type + __test(...); public: - static constexpr bool value = sizeof(__test<_From, _To>(0)) == 1; + typedef decltype(__test<_From, _To>(0)) type; }; + /// is_convertible template<typename _From, typename _To> struct is_convertible - : public integral_constant<bool, - __is_convertible_helper<_From, _To>::value> + : public __is_convertible_helper<_From, _To>::type { }; @@ -2041,29 +2027,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * Use SFINAE to determine if the type _Tp has a publicly-accessible * member type _NTYPE. */ -#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \ - template<typename _Tp> \ - class __has_##_NTYPE##_helper \ - : __sfinae_types \ - { \ - template<typename _Up> \ - struct _Wrap_type \ - { }; \ - \ - template<typename _Up> \ - static __one __test(_Wrap_type<typename _Up::_NTYPE>*); \ - \ - template<typename _Up> \ - static __two __test(...); \ - \ - public: \ - static constexpr bool value = sizeof(__test<_Tp>(0)) == 1; \ - }; \ - \ - template<typename _Tp> \ - struct __has_##_NTYPE \ - : integral_constant<bool, __has_##_NTYPE##_helper \ - <typename remove_cv<_Tp>::type>::value> \ +#define _GLIBCXX_HAS_NESTED_TYPE(_NTYPE) \ + template<typename _Tp> \ + class __has_##_NTYPE##_helper \ + { \ + template<typename _Up> \ + struct _Wrap_type \ + { }; \ + \ + template<typename _Up> \ + static true_type __test(_Wrap_type<typename _Up::_NTYPE>*); \ + \ + template<typename _Up> \ + static false_type __test(...); \ + \ + public: \ + typedef decltype(__test<_Tp>(0)) type; \ + }; \ + \ + template<typename _Tp> \ + struct __has_##_NTYPE \ + : public __has_##_NTYPE##_helper \ + <typename remove_cv<_Tp>::type>::type \ { }; _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc index 4ba4566..ddfee63 100644 --- a/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc +++ b/libstdc++-v3/testsuite/20_util/bind/ref_neg.cc @@ -30,10 +30,10 @@ void test01() { const int dummy = 0; std::bind(&inc, _1)(0); // { dg-error "no match" } - // { dg-error "rvalue|const" "" { target *-*-* } 1347 } - // { dg-error "rvalue|const" "" { target *-*-* } 1361 } - // { dg-error "rvalue|const" "" { target *-*-* } 1375 } - // { dg-error "rvalue|const" "" { target *-*-* } 1389 } + // { dg-error "rvalue|const" "" { target *-*-* } 1315 } + // { dg-error "rvalue|const" "" { target *-*-* } 1329 } + // { dg-error "rvalue|const" "" { target *-*-* } 1343 } + // { dg-error "rvalue|const" "" { target *-*-* } 1357 } std::bind(&inc, std::ref(dummy))(); // { dg-error "no match" } } diff --git a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc index f551d66..348964a 100644 --- a/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc +++ b/libstdc++-v3/testsuite/20_util/declval/requirements/1_neg.cc @@ -19,7 +19,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-error "static assertion failed" "" { target *-*-* } 1871 } +// { dg-error "static assertion failed" "" { target *-*-* } 1857 } #include <utility> diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index d3b6f7c..7da7d1d 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1613 } -// { dg-error "declaration of" "" { target *-*-* } 1577 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1599 } +// { dg-error "declaration of" "" { target *-*-* } 1563 } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 6a0f34c..c769aa9 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -48,5 +48,5 @@ void test01() // { dg-error "required from here" "" { target *-*-* } 40 } // { dg-error "required from here" "" { target *-*-* } 42 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1531 } -// { dg-error "declaration of" "" { target *-*-* } 1495 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 1517 } +// { dg-error "declaration of" "" { target *-*-* } 1481 } diff --git a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc index a0196c0..e4029ba 100644 --- a/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc +++ b/libstdc++-v3/testsuite/20_util/reference_wrapper/typedefs-3.cc @@ -44,7 +44,8 @@ struct S12 : S1, S2 { }; struct S012 : S0, S1, S2 { }; -using std::__sfinae_types; +using std::true_type; +using std::false_type; using std::integral_constant; using std::remove_cv; |