gcc/libstdc++-v3/testsuite
Jonathan Wakely ef8d5ac08b libstdc++: Simplify std::array accessors [PR104719]
This removes the __array_traits::_S_ref and __array_traits::_S_ptr
accessors, which only exist to make the special case of std::array<T, 0>
syntactically well-formed.

By changing the empty type used as the std::array<T, 0>::_M_elems data
member to support operator[] and conversion to a pointer, we can write
code using the natural syntax. The indirection through _S_ref and
_S_ptr is removed for the common case, and a function call is only used
for the special case of zero-size arrays.

The invalid member access for zero-sized arrays is changed to use
__builtin_trap() instead of a null dereference. This guarantees a
runtime error if it ever gets called, instead of undefined behaviour
that is likely to get optimized out as unreachable.

libstdc++-v3/ChangeLog:

	PR libstdc++/104719
	* include/std/array (__array_traits::_S_ref): Remove.
	(__array_traits::_S_ptr): Remove.
	(__array_traits<T, 0>::_Type): Define operator[] and operator T*
	to provide an array-like API.
	(array::_AT_Type): Remove public typeef.
	(array::operator[], array::at, array::front, array::back): Use
	index operator to access _M_elems instead of _S_ref.
	(array::data): Use implicit conversion from _M_elems to pointer.
	(swap(array&, array&)): Use __enable_if_t helper.
	(get<I>): Use index operator to access _M_elems.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
2022-05-04 16:24:56 +01:00
..
17_intro libstdc++: Fix test failure on AIX 2022-03-03 22:25:44 +00:00
18_support testsuite: Disable tests for C++23 that depend on std::unexpected 2022-03-29 20:30:43 +01:00
19_diagnostics libstdc++: Reduce memory usage in std::stacktrace::current 2022-04-12 22:38:31 +01:00
20_util [PR105324] libstdc++: testsuite: pr105324 requires FP from_char 2022-05-03 14:57:15 -03:00
21_strings libstdc++: Fix macro checked by test 2022-04-20 13:54:57 +01:00
22_locale libstdc++: Fix typos in comments in tests 2022-03-28 12:20:42 +01:00
23_containers libstdc++: Simplify std::array accessors [PR104719] 2022-05-04 16:24:56 +01:00
24_iterators libstdc++: Avoid overflow in ranges::advance(i, n, bound) 2022-01-27 22:24:29 +00:00
25_algorithms libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858] 2022-04-15 14:41:14 -04:00
26_numerics libstdc++: Add missing constraints to std::bit_cast [PR105027] 2022-03-23 12:17:16 +00:00
27_io libstdc++: Fix error reporting in filesystem::copy [PR99290] 2022-04-28 13:33:48 +01:00
28_regex
29_atomics libstdc++: Make atomic notify_one and notify_all non-const 2022-04-22 15:53:41 -07:00
30_threads libstdc++: Add deduction guides for std::packaged_task [PR105375] 2022-04-25 16:16:33 +01:00
abi
backward
config
data
decimal
experimental libstdc++: Fix error reporting in filesystem::copy [PR99290] 2022-04-28 13:33:48 +01:00
ext
lib libstdc++: Define <stacktrace> header for C++23 2022-01-17 12:13:02 +00:00
libstdc++-abi
libstdc++-dg
libstdc++-prettyprinters libstdc++: Add pretty printer for std::atomic 2022-04-27 15:48:32 +01:00
libstdc++-xmethods
performance
special_functions
std libstdc++: Reduce header dependencies from PSTL headers [PR92546] 2022-03-18 10:16:36 +00:00
tr1
tr2
util libstdc++: Fix comment in testsuite utility 2022-03-17 12:23:56 +00:00
Makefile.am
Makefile.in libstdc++: Define <stacktrace> header for C++23 2022-01-17 12:13:02 +00:00