]> gcc.gnu.org Git - gcc.git/commitdiff
type_traits (is_convertible): Adjust according to the resolution of TR1 issue 3.20.
authorPaolo Carlini <pcarlini@suse.de>
Thu, 28 Apr 2005 22:35:09 +0000 (22:35 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 28 Apr 2005 22:35:09 +0000 (22:35 +0000)
2005-04-29  Paolo Carlini  <pcarlini@suse.de>

* include/tr1/type_traits (is_convertible): Adjust according
to the resolution of TR1 issue 3.20.
* testsuite/tr1/4_metaprogramming/relationships_between_types/
is_convertible/is_convertible.cc: Add tests.

From-SVN: r98944

libstdc++-v3/ChangeLog
libstdc++-v3/include/tr1/type_traits
libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_convertible/is_convertible.cc

index a2c94e04144b177643a09ada413786471db339e7..9797785e2605815046d369fa77a520c7c0ad9aa8 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-29  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/tr1/type_traits (is_convertible): Adjust according
+       to the resolution of TR1 issue 3.20.
+       * testsuite/tr1/4_metaprogramming/relationships_between_types/
+       is_convertible/is_convertible.cc: Add tests.
+
 2005-04-28  Paolo Carlini  <pcarlini@suse.de>
            Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
index 0bd05bb1198a7067144fffa2efda4c22f22f4749..176a4c334004939efb4c6d2fc405054d99be441d 100644 (file)
@@ -501,7 +501,8 @@ namespace tr1
     };
 
   template<typename _From, typename _To,
-          bool = (is_function<_To>::value || is_array<_To>::value
+          bool = (is_void<_From>::value || is_void<_To>::value
+                  || is_function<_To>::value || is_array<_To>::value
                   // This special case is here only to avoid warnings.            
                   || (is_floating_point<typename
                       remove_reference<_From>::type>::value
@@ -515,7 +516,9 @@ namespace tr1
 
   template<typename _From, typename _To>
     struct __is_convertible_helper<_From, _To, true>
-    { static const bool __value = __is_int_or_cref<_To>::__value; };
+    { static const bool __value = (is_void<_To>::value
+                                  || (__is_int_or_cref<_To>::__value
+                                      && !is_void<_From>::value)); };
 
   template<typename _From, typename _To>
     struct is_convertible
index 858bfda3ad1b25cb3cfcbfd312309b837c0bf171..19b360aca8da4ad394ee4673aa6c14dff240b785 100644 (file)
@@ -54,6 +54,10 @@ void test01()
   VERIFY( (test_relationship<is_convertible, DerivedType*, ClassType*>(true)) );
   VERIFY( (test_relationship<is_convertible, DerivedType&, ClassType&>(true)) );
 
+  VERIFY( (test_relationship<is_convertible, void, void>(true)) );
+  VERIFY( (test_relationship<is_convertible, int, void>(true)) );
+  VERIFY( (test_relationship<is_convertible, int[4], void>(true)) );  
+
   // Negative tests.
   VERIFY( (test_relationship<is_convertible, const int*, int*>(false)) );
   VERIFY( (test_relationship<is_convertible, int*, float*>(false)) );
@@ -69,7 +73,11 @@ void test01()
   VERIFY( (test_relationship<is_convertible, int, ClassType>(false)) );
   VERIFY( (test_relationship<is_convertible, ClassType, DerivedType>(false)) );
   VERIFY( (test_relationship<is_convertible, ClassType*, DerivedType*>(false)) );
-  VERIFY( (test_relationship<is_convertible, ClassType&, DerivedType&>(false)) );  
+  VERIFY( (test_relationship<is_convertible, ClassType&, DerivedType&>(false)) );
+
+  VERIFY( (test_relationship<is_convertible, void, int>(false)) );
+  VERIFY( (test_relationship<is_convertible, void, float>(false)) );  
+  VERIFY( (test_relationship<is_convertible, void, int(*)(int)>(false)) );  
 }
 
 int main()
This page took 0.075622 seconds and 5 git commands to generate.