From patchwork Sat Nov 17 12:12:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3] libstdc++/55363 Date: Sat, 17 Nov 2012 02:12:40 -0000 From: Paolo Carlini X-Patchwork-Id: 199844 Message-Id: <50A77F38.7090501@oracle.com> To: "gcc-patches@gcc.gnu.org" Cc: libstdc++ Hi, a thinko in my work to add debug-mode std::array. Committed to mainline. Thanks, Paolo. ////////////////////////// 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. Index: include/std/array =================================================================== --- include/std/array (revision 193569) +++ include/std/array (working copy) @@ -263,28 +263,7 @@ 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_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 Index: testsuite/23_containers/array/tuple_interface/get_neg.cc =================================================================== --- testsuite/23_containers/array/tuple_interface/get_neg.cc (revision 193569) +++ testsuite/23_containers/array/tuple_interface/get_neg.cc (working copy) @@ -28,6 +28,6 @@ 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 } Index: testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc =================================================================== --- testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc (revision 193569) +++ testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc (working copy) @@ -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 }