gcc/libstdc++-v3/testsuite/20_util
Jonathan Wakely b1983f4582 libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510)
This fixes a regression due to the conditional noexcept-specifier on
std::allocator::construct and std::allocator::destroy, as well as the
corresponding members of new_allocator, malloc_allocator, and
allocator_traits. Those noexcept-specifiers were using expressions which
might be ill-formed, which caused errors outside the immediate context
when checking for the presence of construct and destroy in SFINAE
contexts.

The fix is to use the is_nothrow_constructible and
is_nothrow_destructible type traits instead, because those traits are
safe to use even when the construction/destruction itself is not valid.

The is_nothrow_constructible trait will be false for a type that is not
also nothrow-destructible, even if the new-expression used in the
construct function body is actually noexcept. That's not the correct
answer, but isn't a problem because providing a noexcept-specifier on
these functions is not required by the standard anyway. If the answer is
false when it should be true, that's suboptimal but OK (unlike giving
errors for valid code, or giving a true answer when it should be false).

	PR libstdc++/89510
	* include/bits/alloc_traits.h (allocator_traits::_S_construct)
	(allocator_traits::_S_destroy)
	(allocator_traits<allocator<T>>::construct): Use traits in
	noexcept-specifiers.
	* include/bits/allocator.h (allocator<void>::construct)
	(allocator<void>::destroy): Likewise.
	* include/ext/malloc_allocator.h (malloc_allocator::construct)
	(malloc_allocator::destroy): Likewise.
	* include/ext/new_allocator.h (new_allocator::construct)
	(new_allocator::destroy): Likewise.
	* testsuite/20_util/allocator/89510.cc: New test.
	* testsuite/ext/malloc_allocator/89510.cc: New test.
	* testsuite/ext/new_allocator/89510.cc: New test.
2020-04-30 16:01:43 +01:00
..
add_const Update copyright years. 2020-01-01 12:51:42 +01:00
add_cv Update copyright years. 2020-01-01 12:51:42 +01:00
add_lvalue_reference Update copyright years. 2020-01-01 12:51:42 +01:00
add_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
add_rvalue_reference Update copyright years. 2020-01-01 12:51:42 +01:00
add_volatile Update copyright years. 2020-01-01 12:51:42 +01:00
addressof Update copyright years. 2020-01-01 12:51:42 +01:00
align Update copyright years. 2020-01-01 12:51:42 +01:00
aligned_storage Update copyright years. 2020-01-01 12:51:42 +01:00
aligned_union Update copyright years. 2020-01-01 12:51:42 +01:00
alignment_of Update copyright years. 2020-01-01 12:51:42 +01:00
allocator libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510) 2020-04-30 16:01:43 +01:00
allocator_traits Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
any libstdc++: Fix constructor constraints for std::any (PR 90415) 2020-04-24 00:54:20 +01:00
as_const Update copyright years. 2020-01-01 12:51:42 +01:00
assume_aligned Update copyright years. 2020-01-01 12:51:42 +01:00
auto_ptr Update copyright years. 2020-01-01 12:51:42 +01:00
bad_function_call Update copyright years. 2020-01-01 12:51:42 +01:00
bind x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
bool_constant Update copyright years. 2020-01-01 12:51:42 +01:00
common_reference/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
common_type/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
conditional/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
decay/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
declval/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
default_delete libstdc++: Add comparison operators to std::unique_ptr 2020-04-09 21:10:32 +01:00
duration libstdc++: Add comparison operators to <chrono> types 2020-04-18 00:47:45 +01:00
duration_cast Update copyright years. 2020-01-01 12:51:42 +01:00
enable_if/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
enable_shared_from_this Update copyright years. 2020-01-01 12:51:42 +01:00
exchange libstdc++: Do not define __cpp_lib_constexpr_algorithms in <utility> 2020-04-22 22:54:35 +01:00
extent Update copyright years. 2020-01-01 12:51:42 +01:00
forward Update copyright years. 2020-01-01 12:51:42 +01:00
from_chars libstdc++: Add comparison operators to <charconv> result types 2020-04-08 16:16:10 +01:00
function Update copyright years. 2020-01-01 12:51:42 +01:00
function_objects libstdc++: Fixes for feature test macros (PR 91480) 2020-04-28 23:40:18 +01:00
has_unique_object_representations Update copyright years. 2020-01-01 12:51:42 +01:00
has_virtual_destructor Update copyright years. 2020-01-01 12:51:42 +01:00
hash Update copyright years. 2020-01-01 12:51:42 +01:00
headers Update copyright years. 2020-01-01 12:51:42 +01:00
in_place Update copyright years. 2020-01-01 12:51:42 +01:00
integer_comparisons libstdc++: Fix new tests that fail for ILP32 targets 2020-02-18 18:57:30 +00:00
integer_sequence Update copyright years. 2020-01-01 12:51:42 +01:00
integral_constant Update copyright years. 2020-01-01 12:51:42 +01:00
is_abstract Update copyright years. 2020-01-01 12:51:42 +01:00
is_aggregate Update copyright years. 2020-01-01 12:51:42 +01:00
is_arithmetic Update copyright years. 2020-01-01 12:51:42 +01:00
is_array Update copyright years. 2020-01-01 12:51:42 +01:00
is_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_base_of Update copyright years. 2020-01-01 12:51:42 +01:00
is_bounded_array Update copyright years. 2020-01-01 12:51:42 +01:00
is_class Update copyright years. 2020-01-01 12:51:42 +01:00
is_complete_or_unbounded Update copyright years. 2020-01-01 12:51:42 +01:00
is_compound Update copyright years. 2020-01-01 12:51:42 +01:00
is_const Update copyright years. 2020-01-01 12:51:42 +01:00
is_constant_evaluated Update copyright years. 2020-01-01 12:51:42 +01:00
is_constructible libstdc++: Fix tests that fail in C++20 mode 2020-04-20 22:06:32 +01:00
is_convertible Update copyright years. 2020-01-01 12:51:42 +01:00
is_copy_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_copy_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_default_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_destructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_empty Update copyright years. 2020-01-01 12:51:42 +01:00
is_enum Update copyright years. 2020-01-01 12:51:42 +01:00
is_final Update copyright years. 2020-01-01 12:51:42 +01:00
is_floating_point Update copyright years. 2020-01-01 12:51:42 +01:00
is_function x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_fundamental Update copyright years. 2020-01-01 12:51:42 +01:00
is_implicitly_default_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_integral Update copyright years. 2020-01-01 12:51:42 +01:00
is_invocable Update copyright years. 2020-01-01 12:51:42 +01:00
is_literal_type Update copyright years. 2020-01-01 12:51:42 +01:00
is_lvalue_reference Update copyright years. 2020-01-01 12:51:42 +01:00
is_member_function_pointer x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_member_object_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
is_member_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
is_move_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_move_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_constructible libstdc++: Support arrays in std::is_nothrow_constructible (PR 94149) 2020-04-21 22:18:51 +01:00
is_nothrow_convertible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_copy_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_copy_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_default_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_destructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_invocable Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_move_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_move_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_swappable Update copyright years. 2020-01-01 12:51:42 +01:00
is_nothrow_swappable_with Update copyright years. 2020-01-01 12:51:42 +01:00
is_null_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
is_object x32 does not support MS ABI, skip testcases that require it. 2020-03-16 14:38:06 +01:00
is_pod libstdc++: Fix testsuite failures and warnings due to is_pod deprecation 2020-01-09 21:31:50 +00:00
is_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
is_polymorphic Update copyright years. 2020-01-01 12:51:42 +01:00
is_reference Update copyright years. 2020-01-01 12:51:42 +01:00
is_rvalue_reference Update copyright years. 2020-01-01 12:51:42 +01:00
is_same Update copyright years. 2020-01-01 12:51:42 +01:00
is_scalar Update copyright years. 2020-01-01 12:51:42 +01:00
is_signed Update copyright years. 2020-01-01 12:51:42 +01:00
is_standard_layout Update copyright years. 2020-01-01 12:51:42 +01:00
is_swappable Update copyright years. 2020-01-01 12:51:42 +01:00
is_swappable_with Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivial Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_copy_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_copy_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_copyable Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_default_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_destructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_move_assignable Update copyright years. 2020-01-01 12:51:42 +01:00
is_trivially_move_constructible Update copyright years. 2020-01-01 12:51:42 +01:00
is_unbounded_array Update copyright years. 2020-01-01 12:51:42 +01:00
is_union Update copyright years. 2020-01-01 12:51:42 +01:00
is_unsigned Update copyright years. 2020-01-01 12:51:42 +01:00
is_void Update copyright years. 2020-01-01 12:51:42 +01:00
is_volatile Update copyright years. 2020-01-01 12:51:42 +01:00
logical_traits Update copyright years. 2020-01-01 12:51:42 +01:00
make_signed/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
make_unsigned/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
memory_resource Update copyright years. 2020-01-01 12:51:42 +01:00
monotonic_buffer_resource libstdc++: Define memory resource key functions non-inline (PR93208) 2020-01-09 13:18:20 +00:00
move Update copyright years. 2020-01-01 12:51:42 +01:00
move_if_noexcept Update copyright years. 2020-01-01 12:51:42 +01:00
nonesuch Update copyright years. 2020-01-01 12:51:42 +01:00
optional Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
owner_less Update copyright years. 2020-01-01 12:51:42 +01:00
pair Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
pointer_safety Update copyright years. 2020-01-01 12:51:42 +01:00
pointer_traits Update copyright years. 2020-01-01 12:51:42 +01:00
polymorphic_allocator libstdc++: make polymorphic_allocator throw consistent type (LWG 3237) 2020-02-19 15:34:08 +00:00
rank Update copyright years. 2020-01-01 12:51:42 +01:00
ratio Update copyright years. 2020-01-01 12:51:42 +01:00
raw_storage_iterator Update copyright years. 2020-01-01 12:51:42 +01:00
reference_wrapper Update copyright years. 2020-01-01 12:51:42 +01:00
remove_all_extents Update copyright years. 2020-01-01 12:51:42 +01:00
remove_const Update copyright years. 2020-01-01 12:51:42 +01:00
remove_cv Update copyright years. 2020-01-01 12:51:42 +01:00
remove_cvref Update copyright years. 2020-01-01 12:51:42 +01:00
remove_extent Update copyright years. 2020-01-01 12:51:42 +01:00
remove_pointer Update copyright years. 2020-01-01 12:51:42 +01:00
remove_reference Update copyright years. 2020-01-01 12:51:42 +01:00
remove_volatile Update copyright years. 2020-01-01 12:51:42 +01:00
result_of Update copyright years. 2020-01-01 12:51:42 +01:00
scoped_allocator Update copyright years. 2020-01-01 12:51:42 +01:00
shared_ptr libstdc++: Add comparison operators to std::shared_ptr (PR 94562) 2020-04-14 21:54:55 +01:00
specialized_algorithms libstdc++: Fix regression in std::_Construct (PR 94831) 2020-04-28 23:39:38 +01:00
steady_clock Update copyright years. 2020-01-01 12:51:42 +01:00
synchronized_pool_resource Update copyright years. 2020-01-01 12:51:42 +01:00
system_clock Update copyright years. 2020-01-01 12:51:42 +01:00
time_point libstdc++: Add comparison operators to <chrono> types 2020-04-18 00:47:45 +01:00
time_point_cast Update copyright years. 2020-01-01 12:51:42 +01:00
to_address libstdc++: Add missing feature test macros 2020-04-22 22:54:34 +01:00
to_chars libstdc++: Add comparison operators to <charconv> result types 2020-04-08 16:16:10 +01:00
tuple libstdc++: Fixes for feature test macros (PR 91480) 2020-04-28 23:40:18 +01:00
type_identity/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
typeindex libstdc++: Add spaceship operator to std::type_index 2020-04-15 19:47:47 +01:00
underlying_type/requirements Update copyright years. 2020-01-01 12:51:42 +01:00
unique_ptr libstdc++: Add comparison operators to std::unique_ptr 2020-04-09 21:10:32 +01:00
unsynchronized_pool_resource libstdc++: Fix -Wunused-parameter warning in test 2020-04-16 08:44:10 +01:00
unwrap_reference libstdc++: Add __cpp_lib_unwrap_ref feature test macro 2020-02-19 15:28:54 +00:00
uses_allocator Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
variant Library-side tests for parenthesized aggregate init 2020-03-31 17:07:52 +03:00
void_t Update copyright years. 2020-01-01 12:51:42 +01:00
weak_ptr Update copyright years. 2020-01-01 12:51:42 +01:00
rel_ops.cc Update copyright years. 2020-01-01 12:51:42 +01:00
temporary_buffer.cc Update copyright years. 2020-01-01 12:51:42 +01:00
variable_templates_for_traits.cc Update copyright years. 2020-01-01 12:51:42 +01:00