type_traits (make_signed): Remove specializations for floating point types.
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 8 May 2007 12:10:48 +0000 (12:10 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 8 May 2007 12:10:48 +0000 (12:10 +0000)
2007-05-08  Benjamin Kosnik  <bkoz@redhat.com>

* 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
libstdc++-v3/include/std/type_traits
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-1.cc
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-1.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc

index cc9845dcc8f7da480a58cc291755017511f2e32c..a7f62f99ed64e222d80337ab27fb753e18c5e8a5 100644 (file)
@@ -1,3 +1,15 @@
+2007-05-08  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * 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  <bkoz@redhat.com>
 
        * testsuite/26_numerics/headers/cmath/types_std_c++0x_neg.cc: New.
index 40191887d4956e7f0b39366cd25e933b1bc32bdf..6806ebc255e56cc60f9425f917e97a59b6ab886e 100644 (file)
@@ -185,21 +185,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typedef typename __cv_unsigned::__type __type;
     };
 
-  template<typename _Tp>
-    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<typename _Tp>
     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<typename _Tp, 
           bool _IsInt = is_integral<_Tp>::value,
           bool _IsSigned = is_signed<_Tp>::value,
@@ -283,20 +268,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typedef typename __cv_signed::__type __type;
     };
 
-  template<typename _Tp>
-    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<typename _Tp>
     struct __make_signed_selector<_Tp, false, false, true>
     {
index 826e47ed3e84ad42ab12174d06504708b3601e55..43fc33a6fd2eb74c22e35510dbbf1b54b32a52b6 100644 (file)
@@ -50,13 +50,6 @@ void test01()
   typedef make_signed<volatile wchar_t>::type          test23_type;
   VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) );
 
-#if 0
-  // XXX 
-  // When is_signed works for floating points types this should pass
-  typedef make_signed<volatile float>::type    test24_type;
-  VERIFY( (is_same<test24_type, volatile int>::value) );
-#endif
-
   typedef make_signed<test_enum>::type         test25_type;
   VERIFY( (is_same<test25_type, int>::value) );
 }
index 3a820ace9eba0a73cd99c9801437ff8c9fc0d700..4dd9bb6e5b695478bd618155a8bf4d8c939bb5dc 100644 (file)
@@ -50,13 +50,6 @@ void test01()
   typedef make_signed<volatile wchar_t>::type          test23_type;
   VERIFY( (is_same<test23_type, volatile signed wchar_t>::value) );
 
-#if 0
-  // XXX 
-  // When is_signed works for floating points types this should pass
-  typedef make_signed<volatile float>::type    test24_type;
-  VERIFY( (is_same<test24_type, volatile int>::value) );
-#endif
-
   typedef make_signed<test_enum>::type         test25_type;
   VERIFY( (is_same<test25_type, short>::value) );
 }
index aa94f2a4708e9d2f44f814ecf20c5ad1a4b9641f..063c12eb30b872f56779917e400c25f206174792 100644 (file)
@@ -39,15 +39,18 @@ void test01()
 
   typedef void (fn_type) ();
   typedef make_signed<fn_type>::type   test4_type;
+
+  typedef make_signed<float>::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" }
index b09d3e93aa4f416a2ebc15ae7bc6c0fcaf1f35d1..e204c55f4fd383d964294cc4213ec736e7a44dd4 100644 (file)
@@ -50,13 +50,6 @@ void test01()
   typedef make_unsigned<volatile wchar_t>::type        test23_type;
   VERIFY( (is_same<test23_type, volatile unsigned wchar_t>::value) );
 
-#if 0
-  // XXX 
-  // When is_unsigned works for floating points types this should pass
-  typedef make_unsigned<volatile float>::type          test24_type;
-  VERIFY( (is_same<test24_type, volatile unsigned int>::value) );
-#endif
-
   typedef make_unsigned<test_enum>::type       test25_type;
   VERIFY( (is_same<test25_type, unsigned int>::value) );
 }
index 9e5c64aff2c8d5b1ea9778daacfca31da76e21fe..5038f81e657281c3f6b6d9fd170da8aaefa981ca 100644 (file)
@@ -50,13 +50,6 @@ void test01()
   typedef make_unsigned<volatile wchar_t>::type        test23_type;
   VERIFY( (is_same<test23_type, volatile unsigned wchar_t>::value) );
 
-#if 0
-  // XXX 
-  // When is_unsigned works for floating points types this should pass
-  typedef make_unsigned<volatile float>::type          test24_type;
-  VERIFY( (is_same<test24_type, volatile unsigned int>::value) );
-#endif
-
   typedef make_unsigned<test_enum>::type       test25_type;
   VERIFY( (is_same<test25_type, unsigned short>::value) );
 }
index cc07d6169547fc8484522cb7d483fb740126ae6e..79277a7b0c62007044dbb9a79bf21b405ae1cd6b 100644 (file)
@@ -39,14 +39,17 @@ void test01()
 
   typedef void (fn_type) ();
   typedef make_unsigned<fn_type>::type         test4_type;
+
+  typedef make_unsigned<float>::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" }