Index: include/std/tuple
===================================================================
--- include/std/tuple	(revision 173917)
+++ include/std/tuple	(working copy)
@@ -505,20 +505,54 @@
       typedef _Head type;
     };
 
+  template<std::size_t __i, typename _Tp>
+    struct tuple_element<__i, const _Tp>
+    {
+      typedef typename
+      add_const<typename tuple_element<__i, _Tp>::type>::type type;
+    };
+
+  template<std::size_t __i, typename _Tp>
+    struct tuple_element<__i, volatile _Tp>
+    {
+      typedef typename
+      add_volatile<typename tuple_element<__i, _Tp>::type>::type type;
+    };
+
+  template<std::size_t __i, typename _Tp>
+    struct tuple_element<__i, const volatile _Tp>
+    {
+      typedef typename
+      add_cv<typename tuple_element<__i, _Tp>::type>::type type;
+    };
+
   /// Finds the size of a given tuple type.
   template<typename _Tp>
     struct tuple_size;
 
+  template<typename _Tp>
+    struct tuple_size<const _Tp>
+    : public integral_constant<
+             typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
+             tuple_size<_Tp>::value> { };
+
+  template<typename _Tp>
+    struct tuple_size<volatile _Tp>
+    : public integral_constant<
+             typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
+             tuple_size<_Tp>::value> { };
+
+  template<typename _Tp>
+    struct tuple_size<const volatile _Tp>
+    : public integral_constant<
+             typename remove_cv<decltype(tuple_size<_Tp>::value)>::type,
+             tuple_size<_Tp>::value> { };
+
   /// class tuple_size
   template<typename... _Elements>
-    struct tuple_size<tuple<_Elements...> >
-    {
-      static const std::size_t value = sizeof...(_Elements);
-    };
+    struct tuple_size<tuple<_Elements...>>
+    : public integral_constant<std::size_t, sizeof...(_Elements)> { };
 
-  template<typename... _Elements>
-    const std::size_t tuple_size<tuple<_Elements...> >::value;
-
   template<std::size_t __i, typename _Head, typename... _Tail>
     inline typename __add_ref<_Head>::type
     __get_helper(_Tuple_impl<__i, _Head, _Tail...>& __t) noexcept
Index: include/std/utility
===================================================================
--- include/std/utility	(revision 173917)
+++ include/std/utility	(working copy)
@@ -88,13 +88,9 @@
    // Various functions which give std::pair a tuple-like interface.
   template<class _Tp1, class _Tp2>
     struct tuple_size<std::pair<_Tp1, _Tp2>>
-    { static const std::size_t value = 2; };
+    : public integral_constant<std::size_t, 2> { };
 
   template<class _Tp1, class _Tp2>
-    const std::size_t
-    tuple_size<std::pair<_Tp1, _Tp2> >::value;
-
-  template<class _Tp1, class _Tp2>
     struct tuple_element<0, std::pair<_Tp1, _Tp2>>
     { typedef _Tp1 type; };
  
Index: include/std/array
===================================================================
--- include/std/array	(revision 173917)
+++ include/std/array	(working copy)
@@ -242,18 +242,14 @@
   template<typename _Tp> 
     class tuple_size;
 
+  template<typename _Tp, std::size_t _Nm>
+    struct tuple_size<array<_Tp, _Nm>>
+    : public integral_constant<std::size_t, _Nm> { };
+
   /// tuple_element
   template<std::size_t _Int, typename _Tp>
     class tuple_element;
 
-  template<typename _Tp, std::size_t _Nm>
-    struct tuple_size<array<_Tp, _Nm> >
-    { static const std::size_t value = _Nm; };
-
-  template<typename _Tp, std::size_t _Nm>
-    const std::size_t
-    tuple_size<array<_Tp, _Nm> >::value;  
-
   template<std::size_t _Int, typename _Tp, std::size_t _Nm>
     struct tuple_element<_Int, array<_Tp, _Nm> >
     { typedef _Tp type; };
Index: testsuite/20_util/tuple/cv_tuple_size.cc
===================================================================
--- testsuite/20_util/tuple/cv_tuple_size.cc	(revision 0)
+++ testsuite/20_util/tuple/cv_tuple_size.cc	(revision 0)
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2011 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Tuple
+
+#include <tuple>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+  bool test __attribute__((unused)) = true;
+  using namespace std;
+
+  VERIFY( tuple_size<const tuple<> >::value == 0 );
+  VERIFY( tuple_size<volatile tuple<int> >::value == 1 );
+  VERIFY( tuple_size<const volatile tuple<void> >::value == 1 );
+
+  typedef tuple<int, const int&, void> test_tuple1;
+  VERIFY( tuple_size<const test_tuple1>::value == 3 );
+  VERIFY( tuple_size<const volatile test_tuple1>::value == 3 );
+  VERIFY( tuple_size<volatile tuple<tuple<void> > >::value == 1 );
+}
+
+int main()
+{
+  test01();
+  return 0;
+}
Index: testsuite/20_util/tuple/cv_tuple_element.cc
===================================================================
--- testsuite/20_util/tuple/cv_tuple_element.cc	(revision 0)
+++ testsuite/20_util/tuple/cv_tuple_element.cc	(revision 0)
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// 2011-05-19  Paolo Carlini  <paolo.carlini@oracle.com>
+//
+// Copyright (C) 2011 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 3, 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 COPYING3.  If not see
+// <http://www.gnu.org/licenses/>.
+
+// Tuple
+
+#include <tuple>
+
+using namespace std;
+
+static_assert(is_same<tuple_element<0, const tuple<double, void, int>>::type,
+	      const double>::value, "Error");
+static_assert(is_same<tuple_element<1, volatile tuple<short, void>>::type,
+	      volatile void>::value, "Error");
+static_assert(is_same<tuple_element<2, const volatile tuple<float,
+	      char, int>>::type, const volatile int>::value, "Error");
Index: testsuite/20_util/weak_ptr/comparison/cmp_neg.cc
===================================================================
--- testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(revision 173917)
+++ testsuite/20_util/weak_ptr/comparison/cmp_neg.cc	(working copy)
@@ -51,7 +51,7 @@
 // { dg-warning "note" "" { target *-*-* } 485 }
 // { dg-warning "note" "" { target *-*-* } 479 }
 // { dg-warning "note" "" { target *-*-* } 469 }
-// { dg-warning "note" "" { target *-*-* } 603 }
+// { dg-warning "note" "" { target *-*-* } 637 }
 // { dg-warning "note" "" { target *-*-* } 1056 }
 // { dg-warning "note" "" { target *-*-* } 1050 }
 // { dg-warning "note" "" { target *-*-* } 342 }
