libstdc++: Fix fancy pointer test for std::set

The alloc_ptr.cc test for std::set tries to use C++17 features
unconditionally, and tries to use the C++23 range members which haven't
been implemented for std::set yet.

Some of the range checks are left in place but commented out, so they
can be added after the ranges members are implemented. Others (such as
prepend_range) are not valid for std::set at all.

Also fix uses of internal feature test macros in two other tests, which
should use the standard __cpp_lib_xxx macros.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/set/requirements/explicit_instantiation/alloc_ptr.cc:
	Guard node extraction checks with feature test macro. Remove
	calls to non-existent range members.
	* testsuite/23_containers/forward_list/requirements/explicit_instantiation/alloc_ptr.cc:
	Use standard macro not internal one.
	* testsuite/23_containers/list/requirements/explicit_instantiation/alloc_ptr.cc:
	Likewise.
This commit is contained in:
Jonathan Wakely 2025-01-15 21:24:15 +00:00 committed by Jonathan Wakely
parent 903ab914dd
commit f079feecab
No known key found for this signature in database
3 changed files with 9 additions and 6 deletions

View file

@ -87,7 +87,7 @@ test_template_members(__gnu_test::input_container<short>& c)
l.merge(std::move(l), [](int, int) { return false; });
l.sort([](int, int) { return false; });
#ifdef __glibcxx_ranges_to_container
#ifdef __cpp_lib_ranges_to_container
short arr[2];
__gnu_test::test_input_range<short> r(arr);
std::forward_list<int, Allocator<int>> l2(std::from_range, r);

View file

@ -86,7 +86,7 @@ test_template_members(__gnu_test::input_container<short>& c)
l.merge(std::move(l), [](int, int) { return false; });
l.sort([](int, int) { return false; });
#ifdef __glibcxx_ranges_to_container
#ifdef __cpp_lib_ranges_to_container
short arr[2];
__gnu_test::test_input_range<short> r(arr);
std::list<int, Allocator<int>> l2(std::from_range, r);

View file

@ -69,18 +69,21 @@ test_template_members(__gnu_test::input_container<short>& c)
s.emplace_hint(s.begin(), 1);
s.insert(c.begin(), c.end());
#ifdef __cpp_lib_node_extract
std::set<int, std::greater<int>, Allocator<int>> s1;
s.merge(s1);
std::multiset<int, std::greater<int>, Allocator<int>> m1;
s.merge(m1);
#endif
#ifdef __glibcxx_ranges_to_container
#if 0
#ifdef __cpp_lib_ranges_to_container
short arr[2];
__gnu_test::test_input_range<short> r(arr);
std::set<int, std::less<int>, Allocator<int>> s2(std::from_range, r);
s2.assign_range(r);
s2.prepend_range(r);
s2.append_range(r);
std::set<int, std::less<int>, Allocator<int>> s3(std::from_range, r,
Allocator<int>{});
s2.insert_range(s2.begin(), r);
#endif
#endif
}