From 741aacafff79e60410d224b72bae6364f2c3c40c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Sat, 17 Nov 2012 12:09:58 +0000 Subject: [PATCH] re PR libstdc++/55363 (tuple_size is not a class template) 2012-11-17 Paolo Carlini PR libstdc++/55363 * include/std/array (tuple_size, tuple_element): Move out NAMESPACE_CONTAINER. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust dg-error line numbers. * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise. From-SVN: r193584 --- libstdc++-v3/ChangeLog | 10 ++++ libstdc++-v3/include/std/array | 49 +++++++++++-------- .../array/tuple_interface/get_neg.cc | 6 +-- .../tuple_interface/tuple_element_neg.cc | 2 +- 4 files changed, 42 insertions(+), 25 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9be305b97e8..a2933c52fe4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2012-11-17 Paolo Carlini + + PR libstdc++/55363 + * include/std/array (tuple_size, tuple_element): Move out + NAMESPACE_CONTAINER. + * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust + dg-error line numbers. + * testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: + Likewise. + 2012-11-16 François Dumont * include/bits/hashtable_policy.h (_Prime_rehash_policy): Remove diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 00d3123225c..a4ecf5a547c 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -263,27 +263,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER noexcept(noexcept(__one.swap(__two))) { __one.swap(__two); } - // Tuple interface to class template array. - - /// tuple_size - template - class tuple_size; - - template - struct tuple_size> - : public integral_constant { }; - - /// tuple_element - template - class tuple_element; - - template - struct tuple_element<_Int, array<_Tp, _Nm>> - { - static_assert(_Int < _Nm, "index is out of bounds"); - typedef _Tp type; - }; - template constexpr _Tp& get(array<_Tp, _Nm>& __arr) noexcept @@ -313,6 +292,34 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + // Tuple interface to class template array. + + /// tuple_size + template + class tuple_size; + + template + struct tuple_size<_GLIBCXX_STD_C::array<_Tp, _Nm>> + : public integral_constant { }; + + /// tuple_element + template + class tuple_element; + + template + struct tuple_element<_Int, _GLIBCXX_STD_C::array<_Tp, _Nm>> + { + static_assert(_Int < _Nm, "index is out of bounds"); + typedef _Tp type; + }; + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + #ifdef _GLIBCXX_DEBUG # include #endif diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc index 5df2f0f3816..5c39534d912 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/get_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 *-*-* } 291 } -// { dg-error "static assertion failed" "" { target *-*-* } 300 } -// { dg-error "static assertion failed" "" { target *-*-* } 308 } +// { dg-error "static assertion failed" "" { target *-*-* } 270 } +// { dg-error "static assertion failed" "" { target *-*-* } 279 } +// { dg-error "static assertion failed" "" { target *-*-* } 287 } diff --git a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc index 33c6090b0c8..91fc328c6d8 100644 --- a/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc @@ -23,4 +23,4 @@ typedef std::tuple_element<1, std::array>::type type; -// { dg-error "static assertion failed" "" { target *-*-* } 283 } +// { dg-error "static assertion failed" "" { target *-*-* } 316 }