summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-23 19:51:02 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2015-06-23 19:51:02 +0000
commita1d0f6e13c20b5180246ae2e8649676099cee370 (patch)
tree77923caf4451a4a86c16523c0a78d15127fb32c1 /libstdc++-v3
parentde231ec29421ac250e9592b99987f0d39e708bdd (diff)
downloadgcc-a1d0f6e13c20b5180246ae2e8649676099cee370.tar.gz
2015-06-23 François Dumont <fdumont@gcc.gnu.org>
* include/debug/array: Include <array>. Add version namespace when specializing tuple interface to array. Add specialization for __is_tuple_like_impl. * include/profile/array: Likewise. * include/std/array: Include <utility>. Add specialization for __is_tuple_like_impl. * include/std/tuple (__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move... * include/std/utility: ... here. Include <type_traits>. * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust dg-error line number. * testsuite/23_containers/array/tuple_interface/ tuple_element_debug_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224857 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog16
-rw-r--r--libstdc++-v3/include/debug/array13
-rw-r--r--libstdc++-v3/include/profile/array13
-rw-r--r--libstdc++-v3/include/std/array5
-rw-r--r--libstdc++-v3/include/std/tuple12
-rw-r--r--libstdc++-v3/include/std/utility12
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc6
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc2
8 files changed, 58 insertions, 21 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 5aad2456912..ea6dc8833eb 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,19 @@
+2015-06-23 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/debug/array: Include <array>. Add version namespace when
+ specializing tuple interface to array. Add specialization for
+ __is_tuple_like_impl.
+ * include/profile/array: Likewise.
+ * include/std/array: Include <utility>. Add specialization for
+ __is_tuple_like_impl.
+ * include/std/tuple
+ (__is_tuple_like_impl<>, __is_tuple_like_impl<pair>): Move...
+ * include/std/utility: ... here. Include <type_traits>.
+ * testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Adjust
+ dg-error line number.
+ * testsuite/23_containers/array/tuple_interface/
+ tuple_element_debug_neg.cc: Likewise.
+
2015-06-22 Jonathan Wakely <jwakely@redhat.com>
* testsuite/26_numerics/complex/value_operations/1.cc: Use
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array
index 34e6281da5a..a1c7d408bee 100644
--- a/libstdc++-v3/include/debug/array
+++ b/libstdc++-v3/include/debug/array
@@ -31,6 +31,8 @@
#pragma GCC system_header
+#include <array>
+
#include <debug/formatter.h>
#include <debug/macros.h>
@@ -292,20 +294,27 @@ namespace __debug
}
} // namespace __debug
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Tuple interface to class template array.
/// tuple_size
template<typename _Tp, std::size_t _Nm>
- struct tuple_size<__debug::array<_Tp, _Nm>>
+ struct tuple_size<std::__debug::array<_Tp, _Nm>>
: public integral_constant<std::size_t, _Nm> { };
/// tuple_element
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
- struct tuple_element<_Int, __debug::array<_Tp, _Nm>>
+ struct tuple_element<_Int, std::__debug::array<_Tp, _Nm>>
{
static_assert(_Int < _Nm, "index is out of bounds");
typedef _Tp type;
};
+
+ template<typename _Tp, std::size_t _Nm>
+ struct __is_tuple_like_impl<std::__debug::array<_Tp, _Nm>> : true_type
+ { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_DEBUG_ARRAY
diff --git a/libstdc++-v3/include/profile/array b/libstdc++-v3/include/profile/array
index 434ca968d84..687c0525357 100644
--- a/libstdc++-v3/include/profile/array
+++ b/libstdc++-v3/include/profile/array
@@ -31,6 +31,8 @@
#pragma GCC system_header
+#include <array>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
namespace __profile
@@ -253,20 +255,27 @@ namespace __profile
}
} // namespace __profile
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
// Tuple interface to class template array.
/// tuple_size
template<typename _Tp, std::size_t _Nm>
- struct tuple_size<__profile::array<_Tp, _Nm>>
+ struct tuple_size<std::__profile::array<_Tp, _Nm>>
: public integral_constant<std::size_t, _Nm> { };
/// tuple_element
template<std::size_t _Int, typename _Tp, std::size_t _Nm>
- struct tuple_element<_Int, __profile::array<_Tp, _Nm>>
+ struct tuple_element<_Int, std::__profile::array<_Tp, _Nm>>
{
static_assert(_Int < _Nm, "index is out of bounds");
typedef _Tp type;
};
+
+ template<typename _Tp, std::size_t _Nm>
+ struct __is_tuple_like_impl<std::__profile::array<_Tp, _Nm>> : true_type
+ { };
+
+_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // _GLIBCXX_PROFILE_ARRAY
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index 40fbd46c559..d1b5e6db347 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -35,6 +35,7 @@
# include <bits/c++0x_warning.h>
#else
+#include <utility>
#include <stdexcept>
#include <bits/stl_algobase.h>
#include <bits/range_access.h>
@@ -331,6 +332,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tp type;
};
+ template<typename _Tp, std::size_t _Nm>
+ struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
+ { };
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 953d16b73b1..0504012cbd1 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -976,22 +976,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
forward_as_tuple(_Elements&&... __args) noexcept
{ return tuple<_Elements&&...>(std::forward<_Elements>(__args)...); }
- template<typename>
- struct __is_tuple_like_impl : false_type
- { };
-
template<typename... _Tps>
struct __is_tuple_like_impl<tuple<_Tps...>> : true_type
{ };
- template<typename _T1, typename _T2>
- struct __is_tuple_like_impl<pair<_T1, _T2>> : true_type
- { };
-
- template<typename _Tp, std::size_t _Nm>
- struct __is_tuple_like_impl<_GLIBCXX_STD_C::array<_Tp, _Nm>> : true_type
- { };
-
// Internal type trait that allows us to sfinae-protect tuple_cat.
template<typename _Tp>
struct __is_tuple_like
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 1aac77c10cb..89b68522ddf 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -71,6 +71,7 @@
#if __cplusplus >= 201103L
+#include <type_traits>
#include <bits/move.h>
#include <initializer_list>
@@ -84,7 +85,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<std::size_t _Int, class _Tp>
class tuple_element;
- // Various functions which give std::pair a tuple-like interface.
+ template<typename>
+ struct __is_tuple_like_impl : false_type
+ { };
+
+ // Various functions which give std::pair a tuple-like interface.
+
+ /// Partial specialization for std::pair
+ template<typename _T1, typename _T2>
+ struct __is_tuple_like_impl<std::pair<_T1, _T2>> : true_type
+ { };
/// Partial specialization for std::pair
template<class _Tp1, class _Tp2>
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
index 3e197fd3f31..bc5c726b836 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_debug_neg.cc
@@ -28,6 +28,6 @@ int n1 = std::get<1>(a);
int n2 = std::get<1>(std::move(a));
int n3 = std::get<1>(ca);
-// { dg-error "static assertion failed" "" { target *-*-* } 272 }
-// { dg-error "static assertion failed" "" { target *-*-* } 281 }
-// { dg-error "static assertion failed" "" { target *-*-* } 289 }
+// { dg-error "static assertion failed" "" { target *-*-* } 274 }
+// { dg-error "static assertion failed" "" { target *-*-* } 283 }
+// { dg-error "static assertion failed" "" { target *-*-* } 291 }
diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
index b7472a23a52..a27f3e23846 100644
--- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc
@@ -23,4 +23,4 @@
typedef std::tuple_element<1, std::array<int, 1>>::type type;
-// { dg-error "static assertion failed" "" { target *-*-* } 306 }
+// { dg-error "static assertion failed" "" { target *-*-* } 309 }