This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Small further simplification of std::is_convertible


Hi,

tested x86_64-linux, committed to mainline.

Paolo.

////////////////////
2009-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/std/type_traits (__is_convertible_simple): Remove.
	(__is_convertible_helper): Adjust.
	* testsuite/20_util/make_signed/requirements/typedefs_neg.cc: Adjust
	dg-error line numbers.
	* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc:
	Likewise.
Index: include/std/type_traits
===================================================================
--- include/std/type_traits	(revision 153742)
+++ include/std/type_traits	(working copy)
@@ -240,34 +240,26 @@
     { };
 
   // Relationships between types.
+  template<typename _From, typename _To,
+	   bool = (is_void<_From>::value || is_void<_To>::value
+		   || is_function<_To>::value || is_array<_To>::value)>
+    struct __is_convertible_helper
+    { static const bool __value = (is_void<_From>::value
+				   && is_void<_To>::value); };
+
   template<typename _From, typename _To>
-    struct __is_convertible_simple
+    struct __is_convertible_helper<_From, _To, false>
     : public __sfinae_types
     {
     private:
       static __one __test(_To);
       static __two __test(...);
-      static _From __makeFrom();
-    
+      static typename add_rvalue_reference<_From>::type __makeFrom();
+
     public:
       static const bool __value = sizeof(__test(__makeFrom())) == 1;
     };
 
-  template<typename _From, typename _To,
-	   bool = (is_void<_From>::value || is_void<_To>::value
-		   || is_function<_To>::value || is_array<_To>::value)>
-    struct __is_convertible_helper
-    {
-      static const bool __value = (__is_convertible_simple<typename
-				   add_rvalue_reference<_From>::type,
-				   _To>::__value);
-    };
-
-  template<typename _From, typename _To>
-    struct __is_convertible_helper<_From, _To, true>
-    { static const bool __value = (is_void<_From>::value
-				   && is_void<_To>::value); };
-
   // XXX FIXME
   // The C++0x specifications require front-end support, see N2255.
   /// is_convertible
Index: testsuite/20_util/make_signed/requirements/typedefs_neg.cc
===================================================================
--- testsuite/20_util/make_signed/requirements/typedefs_neg.cc	(revision 153742)
+++ testsuite/20_util/make_signed/requirements/typedefs_neg.cc	(working copy)
@@ -48,8 +48,8 @@
 // { dg-error "instantiated from here" "" { target *-*-* } 40 }
 // { dg-error "instantiated from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 554 }
-// { dg-error "declaration of" "" { target *-*-* } 516 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 546 }
+// { dg-error "declaration of" "" { target *-*-* } 508 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }
Index: testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc
===================================================================
--- testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc	(revision 153742)
+++ testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc	(working copy)
@@ -48,8 +48,8 @@
 // { dg-error "instantiated from here" "" { target *-*-* } 40 }
 // { dg-error "instantiated from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 475 }
-// { dg-error "declaration of" "" { target *-*-* } 437 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 467 }
+// { dg-error "declaration of" "" { target *-*-* } 429 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]