From fb8ffd109a098d6682e0687ee083fa1c3b80d0b4 Mon Sep 17 00:00:00 2001 From: Benjamin Kosnik Date: Tue, 8 May 2007 12:10:48 +0000 Subject: [PATCH] type_traits (make_signed): Remove specializations for floating point types. 2007-05-08 Benjamin Kosnik * include/std/type_traits (make_signed): Remove specializations for floating point types. (make_unsigned): Same. * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Fix. * testsuite/20_util/make_signed/requirements/typedefs-1.cc: Same. * testsuite/20_util/make_signed/requirements/typedefs-2.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Same. * testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Same. From-SVN: r124543 --- libstdc++-v3/ChangeLog | 12 +++++++ libstdc++-v3/include/std/type_traits | 31 +------------------ .../make_signed/requirements/typedefs-1.cc | 7 ----- .../make_signed/requirements/typedefs-2.cc | 7 ----- .../make_signed/requirements/typedefs_neg.cc | 7 +++-- .../make_unsigned/requirements/typedefs-1.cc | 7 ----- .../make_unsigned/requirements/typedefs-2.cc | 7 ----- .../requirements/typedefs_neg.cc | 5 ++- 8 files changed, 22 insertions(+), 61 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index cc9845dcc8f..a7f62f99ed6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,15 @@ +2007-05-08 Benjamin Kosnik + + * include/std/type_traits (make_signed): Remove specializations + for floating point types. + (make_unsigned): Same. + * testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Fix. + * testsuite/20_util/make_signed/requirements/typedefs-1.cc: Same. + * testsuite/20_util/make_signed/requirements/typedefs-2.cc: Same. + * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same. + * testsuite/20_util/make_unsigned/requirements/typedefs-1.cc: Same. + * testsuite/20_util/make_unsigned/requirements/typedefs-2.cc: Same. + 2007-05-08 Benjamin Kosnik * testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: New. diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 40191887d49..6806ebc255e 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -185,21 +185,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef typename __cv_unsigned::__type __type; }; - template - struct __make_unsigned_selector<_Tp, false, true, false> - { - private: - // GNU floating point types start with sizeof int. - static const bool __b1 = sizeof(_Tp) <= sizeof(unsigned int); - static const bool __b2 = sizeof(_Tp) <= sizeof(unsigned long); - typedef conditional<__b2, unsigned long, unsigned long long> __cond; - typedef typename __cond::type __cond_type; - typedef unsigned int __ui_type; - - public: - typedef typename conditional<__b1, __ui_type, __cond_type>::type __type; - }; - template struct __make_unsigned_selector<_Tp, false, false, true> { @@ -260,7 +245,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { typedef signed long long __type; }; - // Select between arithmetic and enum: not possible to be both. + // Select between integral and enum: not possible to be both. template::value, bool _IsSigned = is_signed<_Tp>::value, @@ -283,20 +268,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) typedef typename __cv_signed::__type __type; }; - template - struct __make_signed_selector<_Tp, false, true, false> - { - // GNU floating point types start with sizeof int. - static const bool __b1 = sizeof(_Tp) <= sizeof(signed int); - static const bool __b2 = sizeof(_Tp) <= sizeof(signed long); - typedef conditional<__b2, signed long, signed long long> __cond; - typedef typename __cond::type __cond_type; - typedef unsigned int __i_type; - - public: - typedef typename conditional<__b1, __i_type, __cond_type>::type __type; - }; - template struct __make_signed_selector<_Tp, false, false, true> { diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc index 826e47ed3e8..43fc33a6fd2 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc @@ -50,13 +50,6 @@ void test01() typedef make_signed::type test23_type; VERIFY( (is_same::value) ); -#if 0 - // XXX - // When is_signed works for floating points types this should pass - typedef make_signed::type test24_type; - VERIFY( (is_same::value) ); -#endif - typedef make_signed::type test25_type; VERIFY( (is_same::value) ); } diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc index 3a820ace9eb..4dd9bb6e5b6 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc @@ -50,13 +50,6 @@ void test01() typedef make_signed::type test23_type; VERIFY( (is_same::value) ); -#if 0 - // XXX - // When is_signed works for floating points types this should pass - typedef make_signed::type test24_type; - VERIFY( (is_same::value) ); -#endif - typedef make_signed::type test25_type; VERIFY( (is_same::value) ); } 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 aa94f2a4708..063c12eb30b 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 @@ -39,15 +39,18 @@ void test01() typedef void (fn_type) (); typedef make_signed::type test4_type; + + typedef make_signed::type test5_type; } // { dg-error "does not name a type" "" { target *-*-* } 34 } // { dg-error "instantiated from here" "" { target *-*-* } 36 } // { dg-error "instantiated from here" "" { target *-*-* } 38 } // { dg-error "instantiated from here" "" { target *-*-* } 41 } +// { dg-error "instantiated from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 320 } -// { dg-error "declaration of" "" { target *-*-* } 268 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 291 } +// { dg-error "declaration of" "" { target *-*-* } 253 } // { dg-excess-errors "At global scope" } // { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc index b09d3e93aa4..e204c55f4fd 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc @@ -50,13 +50,6 @@ void test01() typedef make_unsigned::type test23_type; VERIFY( (is_same::value) ); -#if 0 - // XXX - // When is_unsigned works for floating points types this should pass - typedef make_unsigned::type test24_type; - VERIFY( (is_same::value) ); -#endif - typedef make_unsigned::type test25_type; VERIFY( (is_same::value) ); } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc index 9e5c64aff2c..5038f81e657 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc @@ -50,13 +50,6 @@ void test01() typedef make_unsigned::type test23_type; VERIFY( (is_same::value) ); -#if 0 - // XXX - // When is_unsigned works for floating points types this should pass - typedef make_unsigned::type test24_type; - VERIFY( (is_same::value) ); -#endif - typedef make_unsigned::type test25_type; VERIFY( (is_same::value) ); } 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 cc07d616954..79277a7b0c6 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 @@ -39,14 +39,17 @@ void test01() typedef void (fn_type) (); typedef make_unsigned::type test4_type; + + typedef make_unsigned::type test5_type; } // { dg-error "does not name a type" "" { target *-*-* } 34 } // { dg-error "instantiated from here" "" { target *-*-* } 36 } // { dg-error "instantiated from here" "" { target *-*-* } 38 } // { dg-error "instantiated from here" "" { target *-*-* } 41 } +// { dg-error "instantiated from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 223 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 208 } // { dg-error "declaration of" "" { target *-*-* } 170 } // { dg-excess-errors "At global scope" }