From db5ff2363d705551e44c260d1b589d080c0cc2ef Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 11 Dec 2004 21:46:27 +0000 Subject: [PATCH] type_traits: Implement rank. 2004-12-11 Paolo Carlini * include/tr1/type_traits: Implement rank. * testsuite/testsuite_tr1.h (test_property): Generalize to any value_type. (test_category, test_relationship): Slightly tweak consistently. * testsuite/tr1/4_metaprogramming/type_properties/rank/ rank.cc: New. * testsuite/tr1/4_metaprogramming/type_properties/rank/ typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_compound/is_compound.cc: New. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_compound/typedefs.cc: Likewise. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_arithmetic/is_arithmetic.cc: Tweak consistently with the testsuite_tr1.h changes. * testsuite/tr1/4_metaprogramming/composite_type_traits/ is_fundamental/is_fundamental.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_array/is_array.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_floating_point/is_floating_point.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_integral/is_integral.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_reference/is_reference.cc: Likewise. * testsuite/tr1/4_metaprogramming/primary_type_categories/ is_void/is_void.cc: Likewise. * testsuite/tr1/4_metaprogramming/relationships_between_types/ is_same/is_same.cc: Likewise. * testsuite/tr1/4_metaprogramming/type_properties/is_const/ is_const.cc: Likewise. * testsuite/tr1/4_metaprogramming/type_properties/is_volatile/ is_volatile.cc: Likewise. From-SVN: r92033 --- libstdc++-v3/ChangeLog | 38 ++++++++++++++ libstdc++-v3/include/tr1/type_traits | 19 +++++-- libstdc++-v3/testsuite/testsuite_tr1.h | 36 ++++++------- .../is_arithmetic/is_arithmetic.cc | 34 ++++++------ .../is_compound/is_compound.cc | 60 ++++++++++++++++++++++ .../composite_type_traits/is_compound/typedefs.cc | 36 +++++++++++++ .../is_fundamental/is_fundamental.cc | 34 ++++++------ .../primary_type_categories/is_array/is_array.cc | 26 +++++----- .../is_floating_point/is_floating_point.cc | 34 ++++++------ .../is_integral/is_integral.cc | 34 ++++++------ .../is_reference/is_reference.cc | 8 +-- .../primary_type_categories/is_void/is_void.cc | 34 ++++++------ .../relationships_between_types/is_same/is_same.cc | 16 +++--- .../type_properties/is_const/is_const.cc | 16 +++--- .../type_properties/is_volatile/is_volatile.cc | 16 +++--- .../4_metaprogramming/type_properties/rank/rank.cc | 47 +++++++++++++++++ .../type_properties/rank/typedefs.cc | 36 +++++++++++++ 17 files changed, 375 insertions(+), 149 deletions(-) create mode 100644 libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/is_compound.cc create mode 100644 libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/typedefs.cc create mode 100644 libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/rank.cc create mode 100644 libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/typedefs.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f4ddc1c..4de8634 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,41 @@ +2004-12-11 Paolo Carlini + + * include/tr1/type_traits: Implement rank. + * testsuite/testsuite_tr1.h (test_property): Generalize to any + value_type. + (test_category, test_relationship): Slightly tweak consistently. + * testsuite/tr1/4_metaprogramming/type_properties/rank/ + rank.cc: New. + * testsuite/tr1/4_metaprogramming/type_properties/rank/ + typedefs.cc: Likewise. + + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_compound/is_compound.cc: New. + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_compound/typedefs.cc: Likewise. + + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_arithmetic/is_arithmetic.cc: Tweak consistently with the + testsuite_tr1.h changes. + * testsuite/tr1/4_metaprogramming/composite_type_traits/ + is_fundamental/is_fundamental.cc: Likewise. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_array/is_array.cc: Likewise. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_floating_point/is_floating_point.cc: Likewise. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_integral/is_integral.cc: Likewise. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_reference/is_reference.cc: Likewise. + * testsuite/tr1/4_metaprogramming/primary_type_categories/ + is_void/is_void.cc: Likewise. + * testsuite/tr1/4_metaprogramming/relationships_between_types/ + is_same/is_same.cc: Likewise. + * testsuite/tr1/4_metaprogramming/type_properties/is_const/ + is_const.cc: Likewise. + * testsuite/tr1/4_metaprogramming/type_properties/is_volatile/ + is_volatile.cc: Likewise. + 2004-12-10 Paolo Carlini * include/tr1/type_traits: Implement remove_const, remove_volatile, diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index 13d7ebd..5e16637 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -233,8 +233,17 @@ namespace tr1 template struct alignment_of; + template + struct rank + : public integral_constant { }; + + template + struct rank<_Tp[_Size]> + : public integral_constant::value> { }; + template - struct rank; + struct rank<_Tp[]> + : public integral_constant::value> { }; template struct extent; @@ -324,25 +333,25 @@ namespace tr1 template struct remove_extent { - typedef _Tp type; + typedef _Tp type; }; template struct remove_extent<_Tp[_Size]> { - typedef _Tp type; + typedef _Tp type; }; template struct remove_extent<_Tp[]> { - typedef _Tp type; + typedef _Tp type; }; template struct remove_all_extents { - typedef _Tp type; + typedef _Tp type; }; template diff --git a/libstdc++-v3/testsuite/testsuite_tr1.h b/libstdc++-v3/testsuite/testsuite_tr1.h index b3d4cf9..c9d8d23 100644 --- a/libstdc++-v3/testsuite/testsuite_tr1.h +++ b/libstdc++-v3/testsuite/testsuite_tr1.h @@ -35,41 +35,41 @@ namespace __gnu_test { // For tr1/type_traits. template class Category, - typename Type, bool Tv> + typename Type> bool - test_category() + test_category(bool value) { bool ret = true; - ret &= Category::value == Tv; - ret &= Category::value == Tv; - ret &= Category::value == Tv; - ret &= Category::value == Tv; - ret &= Category::type::value == Tv; - ret &= Category::type::value == Tv; - ret &= Category::type::value == Tv; - ret &= Category::type::value == Tv; + ret &= Category::value == value; + ret &= Category::value == value; + ret &= Category::value == value; + ret &= Category::value == value; + ret &= Category::type::value == value; + ret &= Category::type::value == value; + ret &= Category::type::value == value; + ret &= Category::type::value == value; return ret; } template class Property, - typename Type, bool Tv> + typename Type> bool - test_property() + test_property(typename Property::value_type value) { bool ret = true; - ret &= Property::value == Tv; - ret &= Property::type::value == Tv; + ret &= Property::value == value; + ret &= Property::type::value == value; return ret; } template class Relationship, - typename Type1, typename Type2, bool Tv> + typename Type1, typename Type2> bool - test_relationship() + test_relationship(bool value) { bool ret = true; - ret &= Relationship::value == Tv; - ret &= Relationship::type::value == Tv; + ret &= Relationship::value == value; + ret &= Relationship::type::value == value; return ret; } diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_arithmetic/is_arithmetic.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_arithmetic/is_arithmetic.cc index a507d86..2bd8c52 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_arithmetic/is_arithmetic.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_arithmetic/is_arithmetic.cc @@ -30,28 +30,28 @@ void test01() using std::tr1::is_arithmetic; using namespace __gnu_test; - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); #ifdef _GLIBCXX_USE_WCHAR_T - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); #endif - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/is_compound.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/is_compound.cc new file mode 100644 index 0000000..4e190a6 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/is_compound.cc @@ -0,0 +1,60 @@ +// 2004-12-11 Paolo Carlini +// +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 4.5.2 Composite type traits + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::is_compound; + using namespace __gnu_test; + + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); +#ifdef _GLIBCXX_USE_WCHAR_T + VERIFY( (test_category(false)) ); +#endif + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + + // Sanity check. + VERIFY( (test_category(true)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/typedefs.cc new file mode 100644 index 0000000..ced2203 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_compound/typedefs.cc @@ -0,0 +1,36 @@ +// 2004-12-11 Paolo Carlini +// +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::is_compound test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_fundamental/is_fundamental.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_fundamental/is_fundamental.cc index 9106ee5..9bb66a1 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_fundamental/is_fundamental.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/composite_type_traits/is_fundamental/is_fundamental.cc @@ -30,27 +30,27 @@ void test01() using std::tr1::is_fundamental; using namespace __gnu_test; - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); #ifdef _GLIBCXX_USE_WCHAR_T - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); #endif - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_array/is_array.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_array/is_array.cc index bb4e363..0505212 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_array/is_array.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_array/is_array.cc @@ -30,21 +30,21 @@ void test01() using std::tr1::is_array; using namespace __gnu_test; - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_floating_point/is_floating_point.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_floating_point/is_floating_point.cc index c24de1a..c0496eb 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_floating_point/is_floating_point.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_floating_point/is_floating_point.cc @@ -30,28 +30,28 @@ void test01() using std::tr1::is_floating_point; using namespace __gnu_test; - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); #ifdef _GLIBCXX_USE_WCHAR_T - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); #endif - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_integral/is_integral.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_integral/is_integral.cc index 812ff08..95221dc 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_integral/is_integral.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_integral/is_integral.cc @@ -30,29 +30,29 @@ void test01() using std::tr1::is_integral; using namespace __gnu_test; - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); #ifdef _GLIBCXX_USE_WCHAR_T - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); #endif - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_reference/is_reference.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_reference/is_reference.cc index cd59f4d..7409368 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_reference/is_reference.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_reference/is_reference.cc @@ -34,12 +34,12 @@ void test01() typedef ClassType& ClassType_ref; typedef int (&fun_ref) (int); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); + VERIFY( (test_category(true)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_void/is_void.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_void/is_void.cc index e65208c..45e4821 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_void/is_void.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/primary_type_categories/is_void/is_void.cc @@ -30,28 +30,28 @@ void test01() using std::tr1::is_void; using namespace __gnu_test; - VERIFY( (test_category()) ); + VERIFY( (test_category(true)) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); #ifdef _GLIBCXX_USE_WCHAR_T - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); #endif - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); + VERIFY( (test_category(false)) ); // Sanity check. - VERIFY( (test_category()) ); + VERIFY( (test_category(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_same/is_same.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_same/is_same.cc index 32d65af..29bd8a5 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_same/is_same.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/relationships_between_types/is_same/is_same.cc @@ -31,16 +31,16 @@ void test01() using namespace __gnu_test; // Positive tests. - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); + VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); + VERIFY( (test_relationship(true)) ); // Negative tests. - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); - VERIFY( (test_relationship()) ); + VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); + VERIFY( (test_relationship(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_const/is_const.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_const/is_const.cc index 82de428..09c0a3c 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_const/is_const.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_const/is_const.cc @@ -31,16 +31,16 @@ void test01() using namespace __gnu_test; // Positive tests. - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); // Negative tests. - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_volatile/is_volatile.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_volatile/is_volatile.cc index c47ec78..9747d95 100644 --- a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_volatile/is_volatile.cc +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_volatile/is_volatile.cc @@ -31,16 +31,16 @@ void test01() using namespace __gnu_test; // Positive tests. - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); + VERIFY( (test_property(true)) ); // Negative tests. - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); - VERIFY( (test_property()) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); + VERIFY( (test_property(false)) ); } int main() diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/rank.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/rank.cc new file mode 100644 index 0000000..d725d4f --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/rank.cc @@ -0,0 +1,47 @@ +// 2004-12-11 Paolo Carlini +// +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 4.5.3 Type properties + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::tr1::rank; + using namespace __gnu_test; + + VERIFY( (test_property(0)) ); + VERIFY( (test_property(1)) ); + VERIFY( (test_property(2)) ); + VERIFY( (test_property(6)) ); + VERIFY( (test_property(0)) ); + VERIFY( (test_property(1)) ); + VERIFY( (test_property(2)) ); + VERIFY( (test_property(6)) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/typedefs.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/typedefs.cc new file mode 100644 index 0000000..7cbd600 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/typedefs.cc @@ -0,0 +1,36 @@ +// 2004-12-11 Paolo Carlini +// +// Copyright (C) 2004 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// +// NB: This file is for testing tr1/type_traits with NO OTHER INCLUDES. + +#include + +// { dg-do compile } + +void test01() +{ + // Check for required typedefs + typedef std::tr1::rank test_type; + typedef test_type::value_type value_type; + typedef test_type::type type; + typedef test_type::type::value_type type_value_type; + typedef test_type::type::type type_type; +} -- 2.7.4