[PATCH] libstdc++/72745 add static assertion for invalid tuple access

Jonathan Wakely jwakely@redhat.com
Sun Jul 31 18:14:00 GMT 2016


On 31/07/16 18:10 +0100, Jonathan Wakely wrote:
>	PR libstdc++/72745
>	* include/std/array (get): Use positive message for static assertions.
>	* include/std/functional (_Safe_tuple_element_t): Fix indentation.
>	* include/std/tuple (tuple_element<I, tuple<>>): Add partial
>	specialization for invalid indices, with static assertion.
>	* testsuite/20_util/tuple/element_access/get_neg.cc: New test.
>
>This improves the diagnostic for std::get<1>( tuple<int>{} ) by adding
>a static assertion that the index is in range.
>
>Tested powerpc64-linux, committed to trunk.

While working on this I noticed that the test for std::get<I> on a
std::pair only runs as C++14, but should also run for C++11 (which is
easy to do with the new effective target support I committed earlier
today).

Tested x86_64-linux, committed to trunk.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 757 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20160731/0bdbd404/attachment.bin>


More information about the Libstdc++ mailing list