diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a2c94e04144b..9797785e2605 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2005-04-29 Paolo Carlini + + * 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 Gabriel Dos Reis diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index 0bd05bb1198a..176a4c334004 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -501,7 +501,8 @@ namespace tr1 }; template::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::type>::value @@ -515,7 +516,9 @@ namespace tr1 template 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 struct is_convertible diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_convertible/is_convertible.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_convertible/is_convertible.cc index 858bfda3ad1b..19b360aca8da 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_convertible/is_convertible.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_convertible/is_convertible.cc @@ -54,6 +54,10 @@ void test01() VERIFY( (test_relationship(true)) ); VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); + // Negative tests. VERIFY( (test_relationship(false)) ); VERIFY( (test_relationship(false)) ); @@ -69,7 +73,11 @@ void test01() VERIFY( (test_relationship(false)) ); VERIFY( (test_relationship(false)) ); VERIFY( (test_relationship(false)) ); - VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); + + VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); } int main()