gcc/libstdc++-v3/testsuite/23_containers/array/requirements/version.cc
Jonathan Wakely 43626143c9 libstdc++: Add freestanding feature test macros (P2407R5)
This C++26 change makes several classes "partially freestanding", but we
already fully supported them in freestanding mode. All we need to do is
define the new feature test macros and add tests for them.

libstdc++-v3/ChangeLog:

	* include/bits/version.def (freestanding_algorithm)
	(freestanding_array, freestanding_optional)
	(freestanding_string_view, freestanding_variant): Add.
	* include/bits/version.h: Regenerate.
	* include/std/algorithm (__glibcxx_want_freestanding_algorithm):
	Define.
	* include/std/array (__glibcxx_want_freestanding_array):
	Define.
	* include/std/optional (__glibcxx_want_freestanding_optional):
	Define.
	* include/std/string_view
	(__glibcxx_want_freestanding_string_view): Define.
	* include/std/variant (__glibcxx_want_freestanding_variant):
	Define.
	* testsuite/20_util/optional/version.cc: Add checks for
	__cpp_lib_freestanding_optional.
	* testsuite/20_util/variant/version.cc: Add checks for
	__cpp_lib_freestanding_variant.
	* testsuite/23_containers/array/tuple_interface/get_neg.cc:
	Adjust dg-error line numbers.
	* testsuite/21_strings/basic_string_view/requirements/version.cc:
	New test.
	* testsuite/23_containers/array/requirements/version.cc: New
	test.
	* testsuite/25_algorithms/fill_n/requirements/version.cc: New
	test.
	* testsuite/25_algorithms/swap_ranges/requirements/version.cc:
	New test.
2023-11-21 15:58:21 +00:00

19 lines
654 B
C++

// { dg-do preprocess { target c++23 } }
// { dg-add-options no_pch }
#include <array>
#ifndef __cpp_lib_freestanding_array
# error "Feature test macro for freestanding std::array is missing in <array>"
#elif __cpp_lib_freestanding_array < 202311L
# error "Feature test macro for freestanding std::array has wrong value in <array>"
#endif
#undef __cpp_lib_freestanding_array
#include <version>
#ifndef __cpp_lib_freestanding_array
# error "Feature test macro for freestanding std::array is missing in <version>"
#elif __cpp_lib_freestanding_array < 202311L
# error "Feature test macro for freestanding std::array has wrong value in <version>"
#endif