From db5ff2363d705551e44c260d1b589d080c0cc2ef Mon Sep 17 00:00:00 2001
From: Paolo Carlini <pcarlini@suse.de>
Date: Sat, 11 Dec 2004 21:46:27 +0000
Subject: [PATCH] type_traits: Implement rank.

2004-12-11  Paolo Carlini  <pcarlini@suse.de>

	* 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 +++++++++++++++++++
 .../is_compound/typedefs.cc                   | 36 +++++++++++
 .../is_fundamental/is_fundamental.cc          | 34 +++++------
 .../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 +--
 .../is_void/is_void.cc                        | 34 +++++------
 .../is_same/is_same.cc                        | 16 ++---
 .../type_properties/is_const/is_const.cc      | 16 ++---
 .../is_volatile/is_volatile.cc                | 16 ++---
 .../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 f4ddc1c1e507..4de8634dc420 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,41 @@
+2004-12-11  Paolo Carlini  <pcarlini@suse.de>
+
+	* 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  <pcarlini@suse.de>
 
 	* 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 13d7ebdf64d4..5e16637e46d7 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -233,8 +233,17 @@ namespace tr1
   template<typename _Tp>
     struct alignment_of;
   
+  template<typename>
+    struct rank
+    : public integral_constant<std::size_t, 0> { };
+   
+  template<typename _Tp, std::size_t _Size>
+    struct rank<_Tp[_Size]>
+    : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
+
   template<typename _Tp>
-    struct rank;
+    struct rank<_Tp[]>
+    : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
    
   template<typename _Tp, unsigned _Uint = 0>
     struct extent;
@@ -324,25 +333,25 @@ namespace tr1
   template<typename _Tp>
     struct remove_extent
     {
-      typedef _Tp   type;
+      typedef _Tp     type;
     };
 
   template<typename _Tp, std::size_t _Size>
     struct remove_extent<_Tp[_Size]>
     {
-      typedef _Tp   type;
+      typedef _Tp     type;
     };
 
   template<typename _Tp>
     struct remove_extent<_Tp[]>
     {
-      typedef _Tp   type;
+      typedef _Tp     type;
     };
 
   template<typename _Tp>
     struct remove_all_extents
     {
-      typedef _Tp   type;
+      typedef _Tp     type;
     };
 
   template<typename _Tp, std::size_t _Size>
diff --git a/libstdc++-v3/testsuite/testsuite_tr1.h b/libstdc++-v3/testsuite/testsuite_tr1.h
index b3d4cf94f17c..c9d8d235781d 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<template<typename> class Category,
-	   typename Type, bool Tv>
+	   typename Type>
     bool
-    test_category()
+    test_category(bool value)
     {
       bool ret = true;
-      ret &= Category<Type>::value == Tv;
-      ret &= Category<const Type>::value == Tv;
-      ret &= Category<volatile Type>::value == Tv;
-      ret &= Category<const volatile Type>::value == Tv;
-      ret &= Category<Type>::type::value == Tv;
-      ret &= Category<const Type>::type::value == Tv;
-      ret &= Category<volatile Type>::type::value == Tv;
-      ret &= Category<const volatile Type>::type::value == Tv;
+      ret &= Category<Type>::value == value;
+      ret &= Category<const Type>::value == value;
+      ret &= Category<volatile Type>::value == value;
+      ret &= Category<const volatile Type>::value == value;
+      ret &= Category<Type>::type::value == value;
+      ret &= Category<const Type>::type::value == value;
+      ret &= Category<volatile Type>::type::value == value;
+      ret &= Category<const volatile Type>::type::value == value;
       return ret;
     }
 
   template<template<typename> class Property,
-	   typename Type, bool Tv>
+	   typename Type>
     bool
-    test_property()
+    test_property(typename Property<Type>::value_type value)
     {
       bool ret = true;
-      ret &= Property<Type>::value == Tv;
-      ret &= Property<Type>::type::value == Tv;
+      ret &= Property<Type>::value == value;
+      ret &= Property<Type>::type::value == value;
       return ret;
     }
 
   template<template<typename, typename> class Relationship,
-	   typename Type1, typename Type2, bool Tv>
+	   typename Type1, typename Type2>
     bool
-    test_relationship()
+    test_relationship(bool value)
     {
       bool ret = true;
-      ret &= Relationship<Type1, Type2>::value == Tv;
-      ret &= Relationship<Type1, Type2>::type::value == Tv;
+      ret &= Relationship<Type1, Type2>::value == value;
+      ret &= Relationship<Type1, Type2>::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 a507d8609790..2bd8c52d9bed 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<is_arithmetic, void, false>()) );
+  VERIFY( (test_category<is_arithmetic, void>(false)) );
 
-  VERIFY( (test_category<is_arithmetic, char, true>()) );
-  VERIFY( (test_category<is_arithmetic, signed char, true>()) );
-  VERIFY( (test_category<is_arithmetic, unsigned char, true>()) );
+  VERIFY( (test_category<is_arithmetic, char>(true)) );
+  VERIFY( (test_category<is_arithmetic, signed char>(true)) );
+  VERIFY( (test_category<is_arithmetic, unsigned char>(true)) );
 #ifdef _GLIBCXX_USE_WCHAR_T
-  VERIFY( (test_category<is_arithmetic, wchar_t, true>()) );
+  VERIFY( (test_category<is_arithmetic, wchar_t>(true)) );
 #endif
-  VERIFY( (test_category<is_arithmetic, short, true>()) );
-  VERIFY( (test_category<is_arithmetic, unsigned short, true>()) );
-  VERIFY( (test_category<is_arithmetic, int, true>()) );
-  VERIFY( (test_category<is_arithmetic, unsigned int, true>()) );
-  VERIFY( (test_category<is_arithmetic, long, true>()) );
-  VERIFY( (test_category<is_arithmetic, unsigned long, true>()) );
-  VERIFY( (test_category<is_arithmetic, long long, true>()) );
-  VERIFY( (test_category<is_arithmetic, unsigned long long, true>()) );
-  VERIFY( (test_category<is_arithmetic, float, true>()) );
-  VERIFY( (test_category<is_arithmetic, double, true>()) );
-  VERIFY( (test_category<is_arithmetic, long double, true>()) );
+  VERIFY( (test_category<is_arithmetic, short>(true)) );
+  VERIFY( (test_category<is_arithmetic, unsigned short>(true)) );
+  VERIFY( (test_category<is_arithmetic, int>(true)) );
+  VERIFY( (test_category<is_arithmetic, unsigned int>(true)) );
+  VERIFY( (test_category<is_arithmetic, long>(true)) );
+  VERIFY( (test_category<is_arithmetic, unsigned long>(true)) );
+  VERIFY( (test_category<is_arithmetic, long long>(true)) );
+  VERIFY( (test_category<is_arithmetic, unsigned long long>(true)) );
+  VERIFY( (test_category<is_arithmetic, float>(true)) );
+  VERIFY( (test_category<is_arithmetic, double>(true)) );
+  VERIFY( (test_category<is_arithmetic, long double>(true)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_arithmetic, ClassType, false>()) );
+  VERIFY( (test_category<is_arithmetic, ClassType>(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 000000000000..4e190a6d8b08
--- /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  <pcarlini@suse.de>
+//
+// 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 <tr1/type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using std::tr1::is_compound;
+  using namespace __gnu_test;
+  
+  VERIFY( (test_category<is_compound, void>(false)) );
+  VERIFY( (test_category<is_compound, char>(false)) );
+  VERIFY( (test_category<is_compound, signed char>(false)) );
+  VERIFY( (test_category<is_compound, unsigned char>(false)) );
+#ifdef _GLIBCXX_USE_WCHAR_T
+  VERIFY( (test_category<is_compound, wchar_t>(false)) );
+#endif
+  VERIFY( (test_category<is_compound, short>(false)) );
+  VERIFY( (test_category<is_compound, unsigned short>(false)) );
+  VERIFY( (test_category<is_compound, int>(false)) );
+  VERIFY( (test_category<is_compound, unsigned int>(false)) );
+  VERIFY( (test_category<is_compound, long>(false)) );
+  VERIFY( (test_category<is_compound, unsigned long>(false)) );
+  VERIFY( (test_category<is_compound, long long>(false)) );
+  VERIFY( (test_category<is_compound, unsigned long long>(false)) );
+  VERIFY( (test_category<is_compound, float>(false)) );
+  VERIFY( (test_category<is_compound, double>(false)) );
+  VERIFY( (test_category<is_compound, long double>(false)) );
+
+  // Sanity check.
+  VERIFY( (test_category<is_compound, ClassType>(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 000000000000..ced2203b0fb6
--- /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  <pcarlini@suse.de>
+//
+// 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 <tr1/type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::tr1::is_compound<int>          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 9106ee504ffa..9bb66a1989bb 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<is_fundamental, void, true>()) );
-  VERIFY( (test_category<is_fundamental, char, true>()) );
-  VERIFY( (test_category<is_fundamental, signed char, true>()) );
-  VERIFY( (test_category<is_fundamental, unsigned char, true>()) );
+  VERIFY( (test_category<is_fundamental, void>(true)) );
+  VERIFY( (test_category<is_fundamental, char>(true)) );
+  VERIFY( (test_category<is_fundamental, signed char>(true)) );
+  VERIFY( (test_category<is_fundamental, unsigned char>(true)) );
 #ifdef _GLIBCXX_USE_WCHAR_T
-  VERIFY( (test_category<is_fundamental, wchar_t, true>()) );
+  VERIFY( (test_category<is_fundamental, wchar_t>(true)) );
 #endif
-  VERIFY( (test_category<is_fundamental, short, true>()) );
-  VERIFY( (test_category<is_fundamental, unsigned short, true>()) );
-  VERIFY( (test_category<is_fundamental, int, true>()) );
-  VERIFY( (test_category<is_fundamental, unsigned int, true>()) );
-  VERIFY( (test_category<is_fundamental, long, true>()) );
-  VERIFY( (test_category<is_fundamental, unsigned long, true>()) );
-  VERIFY( (test_category<is_fundamental, long long, true>()) );
-  VERIFY( (test_category<is_fundamental, unsigned long long, true>()) );
-  VERIFY( (test_category<is_fundamental, float, true>()) );
-  VERIFY( (test_category<is_fundamental, double, true>()) );
-  VERIFY( (test_category<is_fundamental, long double, true>()) );
+  VERIFY( (test_category<is_fundamental, short>(true)) );
+  VERIFY( (test_category<is_fundamental, unsigned short>(true)) );
+  VERIFY( (test_category<is_fundamental, int>(true)) );
+  VERIFY( (test_category<is_fundamental, unsigned int>(true)) );
+  VERIFY( (test_category<is_fundamental, long>(true)) );
+  VERIFY( (test_category<is_fundamental, unsigned long>(true)) );
+  VERIFY( (test_category<is_fundamental, long long>(true)) );
+  VERIFY( (test_category<is_fundamental, unsigned long long>(true)) );
+  VERIFY( (test_category<is_fundamental, float>(true)) );
+  VERIFY( (test_category<is_fundamental, double>(true)) );
+  VERIFY( (test_category<is_fundamental, long double>(true)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_fundamental, ClassType, false>()) );
+  VERIFY( (test_category<is_fundamental, ClassType>(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 bb4e363f04f1..0505212c7807 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<is_array, int[2], true>()) );
-  VERIFY( (test_category<is_array, int[], true>()) );
-  VERIFY( (test_category<is_array, int[2][3], true>()) );
-  VERIFY( (test_category<is_array, int[][3], true>()) );
-  VERIFY( (test_category<is_array, float*[2], true>()) );
-  VERIFY( (test_category<is_array, float*[], true>()) );
-  VERIFY( (test_category<is_array, float*[2][3], true>()) );
-  VERIFY( (test_category<is_array, float*[][3], true>()) );
-  VERIFY( (test_category<is_array, ClassType[2], true>()) );
-  VERIFY( (test_category<is_array, ClassType[], true>()) );
-  VERIFY( (test_category<is_array, ClassType[2][3], true>()) );
-  VERIFY( (test_category<is_array, ClassType[][3], true>()) );
+  VERIFY( (test_category<is_array, int[2]>(true)) );
+  VERIFY( (test_category<is_array, int[]>(true)) );
+  VERIFY( (test_category<is_array, int[2][3]>(true)) );
+  VERIFY( (test_category<is_array, int[][3]>(true)) );
+  VERIFY( (test_category<is_array, float*[2]>(true)) );
+  VERIFY( (test_category<is_array, float*[]>(true)) );
+  VERIFY( (test_category<is_array, float*[2][3]>(true)) );
+  VERIFY( (test_category<is_array, float*[][3]>(true)) );
+  VERIFY( (test_category<is_array, ClassType[2]>(true)) );
+  VERIFY( (test_category<is_array, ClassType[]>(true)) );
+  VERIFY( (test_category<is_array, ClassType[2][3]>(true)) );
+  VERIFY( (test_category<is_array, ClassType[][3]>(true)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_array, ClassType, false>()) );
+  VERIFY( (test_category<is_array, ClassType>(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 c24de1a5d5aa..c0496ebad3ea 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<is_floating_point, void, false>()) );
-  VERIFY( (test_category<is_floating_point, char, false>()) );
-  VERIFY( (test_category<is_floating_point, signed char, false>()) );
-  VERIFY( (test_category<is_floating_point, unsigned char, false>()) );
+  VERIFY( (test_category<is_floating_point, void>(false)) );
+  VERIFY( (test_category<is_floating_point, char>(false)) );
+  VERIFY( (test_category<is_floating_point, signed char>(false)) );
+  VERIFY( (test_category<is_floating_point, unsigned char>(false)) );
 #ifdef _GLIBCXX_USE_WCHAR_T
-  VERIFY( (test_category<is_floating_point, wchar_t, false>()) );
+  VERIFY( (test_category<is_floating_point, wchar_t>(false)) );
 #endif
-  VERIFY( (test_category<is_floating_point, short, false>()) );
-  VERIFY( (test_category<is_floating_point, unsigned short, false>()) );
-  VERIFY( (test_category<is_floating_point, int, false>()) );
-  VERIFY( (test_category<is_floating_point, unsigned int, false>()) );
-  VERIFY( (test_category<is_floating_point, long, false>()) );
-  VERIFY( (test_category<is_floating_point, unsigned long, false>()) );
-  VERIFY( (test_category<is_floating_point, long long, false>()) );
-  VERIFY( (test_category<is_floating_point, unsigned long long, false>()) );
+  VERIFY( (test_category<is_floating_point, short>(false)) );
+  VERIFY( (test_category<is_floating_point, unsigned short>(false)) );
+  VERIFY( (test_category<is_floating_point, int>(false)) );
+  VERIFY( (test_category<is_floating_point, unsigned int>(false)) );
+  VERIFY( (test_category<is_floating_point, long>(false)) );
+  VERIFY( (test_category<is_floating_point, unsigned long>(false)) );
+  VERIFY( (test_category<is_floating_point, long long>(false)) );
+  VERIFY( (test_category<is_floating_point, unsigned long long>(false)) );
 
-  VERIFY( (test_category<is_floating_point, float, true>()) );
-  VERIFY( (test_category<is_floating_point, double, true>()) );
-  VERIFY( (test_category<is_floating_point, long double, true>()) );
+  VERIFY( (test_category<is_floating_point, float>(true)) );
+  VERIFY( (test_category<is_floating_point, double>(true)) );
+  VERIFY( (test_category<is_floating_point, long double>(true)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_floating_point, ClassType, false>()) );
+  VERIFY( (test_category<is_floating_point, ClassType>(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 812ff080b812..95221dc406ba 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<is_integral, void, false>()) );
+  VERIFY( (test_category<is_integral, void>(false)) );
   
-  VERIFY( (test_category<is_integral, char, true>()) );
-  VERIFY( (test_category<is_integral, signed char, true>()) );
-  VERIFY( (test_category<is_integral, unsigned char, true>()) );
+  VERIFY( (test_category<is_integral, char>(true)) );
+  VERIFY( (test_category<is_integral, signed char>(true)) );
+  VERIFY( (test_category<is_integral, unsigned char>(true)) );
 #ifdef _GLIBCXX_USE_WCHAR_T
-  VERIFY( (test_category<is_integral, wchar_t, true>()) );
+  VERIFY( (test_category<is_integral, wchar_t>(true)) );
 #endif
-  VERIFY( (test_category<is_integral, short, true>()) );
-  VERIFY( (test_category<is_integral, unsigned short, true>()) );
-  VERIFY( (test_category<is_integral, int, true>()) );
-  VERIFY( (test_category<is_integral, unsigned int, true>()) );
-  VERIFY( (test_category<is_integral, long, true>()) );
-  VERIFY( (test_category<is_integral, unsigned long, true>()) );
-  VERIFY( (test_category<is_integral, long long, true>()) );
-  VERIFY( (test_category<is_integral, unsigned long long, true>()) );
+  VERIFY( (test_category<is_integral, short>(true)) );
+  VERIFY( (test_category<is_integral, unsigned short>(true)) );
+  VERIFY( (test_category<is_integral, int>(true)) );
+  VERIFY( (test_category<is_integral, unsigned int>(true)) );
+  VERIFY( (test_category<is_integral, long>(true)) );
+  VERIFY( (test_category<is_integral, unsigned long>(true)) );
+  VERIFY( (test_category<is_integral, long long>(true)) );
+  VERIFY( (test_category<is_integral, unsigned long long>(true)) );
 
-  VERIFY( (test_category<is_integral, float, false>()) );
-  VERIFY( (test_category<is_integral, double, false>()) );
-  VERIFY( (test_category<is_integral, long double, false>()) );
+  VERIFY( (test_category<is_integral, float>(false)) );
+  VERIFY( (test_category<is_integral, double>(false)) );
+  VERIFY( (test_category<is_integral, long double>(false)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_integral, ClassType, false>()) );
+  VERIFY( (test_category<is_integral, ClassType>(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 cd59f4d6ac1e..7409368c9b6a 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<is_reference, int_ref, true>()) );
-  VERIFY( (test_category<is_reference, ClassType_ref, true>()) );
-  VERIFY( (test_category<is_reference, fun_ref, true>()) );
+  VERIFY( (test_category<is_reference, int_ref>(true)) );
+  VERIFY( (test_category<is_reference, ClassType_ref>(true)) );
+  VERIFY( (test_category<is_reference, fun_ref>(true)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_reference, ClassType, false>()) );
+  VERIFY( (test_category<is_reference, ClassType>(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 e65208c821e8..45e4821756d8 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<is_void, void, true>()) );
+  VERIFY( (test_category<is_void, void>(true)) );
   
-  VERIFY( (test_category<is_void, char, false>()) );
-  VERIFY( (test_category<is_void, signed char, false>()) );
-  VERIFY( (test_category<is_void, unsigned char, false>()) );
+  VERIFY( (test_category<is_void, char>(false)) );
+  VERIFY( (test_category<is_void, signed char>(false)) );
+  VERIFY( (test_category<is_void, unsigned char>(false)) );
 #ifdef _GLIBCXX_USE_WCHAR_T
-  VERIFY( (test_category<is_void, wchar_t, false>()) );
+  VERIFY( (test_category<is_void, wchar_t>(false)) );
 #endif
-  VERIFY( (test_category<is_void, short, false>()) );
-  VERIFY( (test_category<is_void, unsigned short, false>()) );
-  VERIFY( (test_category<is_void, int, false>()) );
-  VERIFY( (test_category<is_void, unsigned int, false>()) );
-  VERIFY( (test_category<is_void, long, false>()) );
-  VERIFY( (test_category<is_void, unsigned long, false>()) );
-  VERIFY( (test_category<is_void, long long, false>()) );
-  VERIFY( (test_category<is_void, unsigned long long, false>()) );
-  VERIFY( (test_category<is_void, float, false>()) );
-  VERIFY( (test_category<is_void, double, false>()) );
-  VERIFY( (test_category<is_void, long double, false>()) );
+  VERIFY( (test_category<is_void, short>(false)) );
+  VERIFY( (test_category<is_void, unsigned short>(false)) );
+  VERIFY( (test_category<is_void, int>(false)) );
+  VERIFY( (test_category<is_void, unsigned int>(false)) );
+  VERIFY( (test_category<is_void, long>(false)) );
+  VERIFY( (test_category<is_void, unsigned long>(false)) );
+  VERIFY( (test_category<is_void, long long>(false)) );
+  VERIFY( (test_category<is_void, unsigned long long>(false)) );
+  VERIFY( (test_category<is_void, float>(false)) );
+  VERIFY( (test_category<is_void, double>(false)) );
+  VERIFY( (test_category<is_void, long double>(false)) );
 
   // Sanity check.
-  VERIFY( (test_category<is_void, ClassType, false>()) );
+  VERIFY( (test_category<is_void, ClassType>(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 32d65af4a6db..29bd8a56b967 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<is_same, int, int, true>()) );
-  VERIFY( (test_relationship<is_same, const int, const int, true>()) );
-  VERIFY( (test_relationship<is_same, int&, int&, true>()) );
-  VERIFY( (test_relationship<is_same, ClassType, ClassType, true>()) );
+  VERIFY( (test_relationship<is_same, int, int>(true)) );
+  VERIFY( (test_relationship<is_same, const int, const int>(true)) );
+  VERIFY( (test_relationship<is_same, int&, int&>(true)) );
+  VERIFY( (test_relationship<is_same, ClassType, ClassType>(true)) );
 
   // Negative tests.
-  VERIFY( (test_relationship<is_same, void, int, false>()) );
-  VERIFY( (test_relationship<is_same, int, const int, false>()) );
-  VERIFY( (test_relationship<is_same, int, int&, false>()) );
-  VERIFY( (test_relationship<is_same, int, ClassType, false>()) );
+  VERIFY( (test_relationship<is_same, void, int>(false)) );
+  VERIFY( (test_relationship<is_same, int, const int>(false)) );
+  VERIFY( (test_relationship<is_same, int, int&>(false)) );
+  VERIFY( (test_relationship<is_same, int, ClassType>(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 82de4285aae4..09c0a3c4820d 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<is_const, const int, true>()) );
-  VERIFY( (test_property<is_const, const volatile int, true>()) );
-  VERIFY( (test_property<is_const, cClassType, true>()) );
-  VERIFY( (test_property<is_const, cvClassType, true>()) );
+  VERIFY( (test_property<is_const, const int>(true)) );
+  VERIFY( (test_property<is_const, const volatile int>(true)) );
+  VERIFY( (test_property<is_const, cClassType>(true)) );
+  VERIFY( (test_property<is_const, cvClassType>(true)) );
 
   // Negative tests.
-  VERIFY( (test_property<is_const, int, false>()) );
-  VERIFY( (test_property<is_const, volatile int, false>()) );
-  VERIFY( (test_property<is_const, ClassType, false>()) );
-  VERIFY( (test_property<is_const, vClassType, false>()) );
+  VERIFY( (test_property<is_const, int>(false)) );
+  VERIFY( (test_property<is_const, volatile int>(false)) );
+  VERIFY( (test_property<is_const, ClassType>(false)) );
+  VERIFY( (test_property<is_const, vClassType>(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 c47ec786aeb2..9747d955644e 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<is_volatile, volatile int, true>()) );
-  VERIFY( (test_property<is_volatile, const volatile int, true>()) );
-  VERIFY( (test_property<is_volatile, vClassType, true>()) );
-  VERIFY( (test_property<is_volatile, cvClassType, true>()) );
+  VERIFY( (test_property<is_volatile, volatile int>(true)) );
+  VERIFY( (test_property<is_volatile, const volatile int>(true)) );
+  VERIFY( (test_property<is_volatile, vClassType>(true)) );
+  VERIFY( (test_property<is_volatile, cvClassType>(true)) );
 
   // Negative tests.
-  VERIFY( (test_property<is_volatile, int, false>()) );
-  VERIFY( (test_property<is_volatile, const int, false>()) );
-  VERIFY( (test_property<is_volatile, ClassType, false>()) );
-  VERIFY( (test_property<is_volatile, cClassType, false>()) );
+  VERIFY( (test_property<is_volatile, int>(false)) );
+  VERIFY( (test_property<is_volatile, const int>(false)) );
+  VERIFY( (test_property<is_volatile, ClassType>(false)) );
+  VERIFY( (test_property<is_volatile, cClassType>(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 000000000000..d725d4f91c60
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/rank.cc
@@ -0,0 +1,47 @@
+// 2004-12-11  Paolo Carlini  <pcarlini@suse.de>
+//
+// 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 <tr1/type_traits>
+#include <testsuite_hooks.h>
+#include <testsuite_tr1.h>
+
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  using std::tr1::rank;
+  using namespace __gnu_test;
+
+  VERIFY( (test_property<rank, int>(0)) );
+  VERIFY( (test_property<rank, int[2]>(1)) );
+  VERIFY( (test_property<rank, int[][4]>(2)) );
+  VERIFY( (test_property<rank, int[2][2][4][4][6][6]>(6)) );
+  VERIFY( (test_property<rank, ClassType>(0)) );
+  VERIFY( (test_property<rank, ClassType[2]>(1)) );
+  VERIFY( (test_property<rank, ClassType[][4]>(2)) );
+  VERIFY( (test_property<rank, ClassType[2][2][4][4][6][6]>(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 000000000000..7cbd600e598b
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/rank/typedefs.cc
@@ -0,0 +1,36 @@
+// 2004-12-11  Paolo Carlini  <pcarlini@suse.de>
+//
+// 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 <tr1/type_traits>
+
+// { dg-do compile }
+
+void test01()
+{
+  // Check for required typedefs
+  typedef std::tr1::rank<int>                 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;
+}
-- 
GitLab