gcc/libstdc++-v3/testsuite/20_util
Jonathan Wakely ce9f305e44 Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r
The definition of is_nothrow_invocable in terms of is_convertible and
is_nothrow_constructible is incorrect, because a type could have an
explicit constructor that means is_nothrow_constructible is true, but
implicit conversions could use a different constructor that is
potentially-throwing.

Fix it by adding a C++11 version of C++20's is_nothrow_convertible that
only considers implicit conversions.

	* include/std/type_traits (__is_nt_convertible_helper): Define it
	unconditionally, not only for C++20.
	(__is_nothrow_convertible): Define internal trait for use in C++11.
	(__is_nt_invocable_impl: Fix by using __is_nothrow_convertible.
	(is_invocable_r_v, is_nothrow_invocable_r_v): Add missing parameter.
	* testsuite/20_util/is_nothrow_convertible/value_ext.cc: New test.
	* testsuite/20_util/is_nothrow_convertible/value.cc: Check with type
	that has nothrow explicit conversion but potentially-throwing implicit
	conversion.
	* testsuite/20_util/is_nothrow_invocable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix helper
	function to only consider implicit conversions.
	* testsuite/20_util/tuple/cons/noexcept_specs.cc: Add comment.

From-SVN: r271171
2019-05-14 15:39:58 +01:00
..
add_const Update copyright years. 2019-01-01 13:31:55 +01:00
add_cv Update copyright years. 2019-01-01 13:31:55 +01:00
add_lvalue_reference Update copyright years. 2019-01-01 13:31:55 +01:00
add_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
add_rvalue_reference Update copyright years. 2019-01-01 13:31:55 +01:00
add_volatile Update copyright years. 2019-01-01 13:31:55 +01:00
addressof Update copyright years. 2019-01-01 13:31:55 +01:00
align Update copyright years. 2019-01-01 13:31:55 +01:00
aligned_storage Update copyright years. 2019-01-01 13:31:55 +01:00
aligned_union Update copyright years. 2019-01-01 13:31:55 +01:00
alignment_of Update copyright years. 2019-01-01 13:31:55 +01:00
allocator Update copyright years. 2019-01-01 13:31:55 +01:00
allocator_traits Add __gnu_test::NullablePointer utility to testsuite 2019-05-14 12:17:23 +01:00
any PR libstdc++/90220 Fix std::any_cast for array types 2019-04-24 16:17:43 +01:00
as_const Update copyright years. 2019-01-01 13:31:55 +01:00
assume_aligned Update copyright years. 2019-01-01 13:31:55 +01:00
auto_ptr Update copyright years. 2019-01-01 13:31:55 +01:00
bad_function_call Update copyright years. 2019-01-01 13:31:55 +01:00
bind Update copyright years. 2019-01-01 13:31:55 +01:00
bool_constant Update copyright years. 2019-01-01 13:31:55 +01:00
common_type/requirements PR libstdc++/89102 implement new common_type rules (P0435R1, P0548R1) 2019-05-07 23:46:39 +01:00
conditional/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
decay/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
declval/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
default_delete PR libstdc++/90388 fix std::hash<unique_ptr<T,D>> bugs 2019-05-10 22:41:16 +01:00
duration PR libstdc++/89102 implement new common_type rules (P0435R1, P0548R1) 2019-05-07 23:46:39 +01:00
duration_cast Update copyright years. 2019-01-01 13:31:55 +01:00
enable_if/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
enable_shared_from_this PR middle-end/89303 add testcase for std::enable_shared_from_this 2019-02-14 09:40:02 +00:00
endian Update copyright years. 2019-01-01 13:31:55 +01:00
exchange Update copyright years. 2019-01-01 13:31:55 +01:00
extent Update copyright years. 2019-01-01 13:31:55 +01:00
forward Update copyright years. 2019-01-01 13:31:55 +01:00
from_chars PR c++/90047 - ICE with enable_if alias template. 2019-04-17 23:32:24 -04:00
function Update copyright years. 2019-01-01 13:31:55 +01:00
function_objects Fix new test to run as well as compile 2019-03-07 14:35:22 +00:00
has_unique_object_representations Update copyright years. 2019-01-01 13:31:55 +01:00
has_virtual_destructor Update copyright years. 2019-01-01 13:31:55 +01:00
hash PR libstdc++/89629 fix _Hash_bytes for lengths > INT_MAX 2019-03-11 13:46:05 +00:00
headers Update copyright years. 2019-01-01 13:31:55 +01:00
in_place Update copyright years. 2019-01-01 13:31:55 +01:00
integer_sequence Update copyright years. 2019-01-01 13:31:55 +01:00
integral_constant Update copyright years. 2019-01-01 13:31:55 +01:00
is_abstract Update copyright years. 2019-01-01 13:31:55 +01:00
is_aggregate Update copyright years. 2019-01-01 13:31:55 +01:00
is_arithmetic Update copyright years. 2019-01-01 13:31:55 +01:00
is_array Update copyright years. 2019-01-01 13:31:55 +01:00
is_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_base_of Update copyright years. 2019-01-01 13:31:55 +01:00
is_bounded_array Add feature test macro for bounded array traits 2019-03-06 15:31:06 +00:00
is_class Update copyright years. 2019-01-01 13:31:55 +01:00
is_compound Update copyright years. 2019-01-01 13:31:55 +01:00
is_const Update copyright years. 2019-01-01 13:31:55 +01:00
is_constant_evaluated Update copyright years. 2019-01-01 13:31:55 +01:00
is_constructible PR c++/86521 - wrong overload resolution with ref-qualifiers. 2019-03-11 23:19:22 -04:00
is_convertible Update copyright years. 2019-01-01 13:31:55 +01:00
is_copy_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_copy_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_default_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_destructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_empty Update copyright years. 2019-01-01 13:31:55 +01:00
is_enum Update copyright years. 2019-01-01 13:31:55 +01:00
is_final Update copyright years. 2019-01-01 13:31:55 +01:00
is_floating_point Update copyright years. 2019-01-01 13:31:55 +01:00
is_function Update copyright years. 2019-01-01 13:31:55 +01:00
is_fundamental Update copyright years. 2019-01-01 13:31:55 +01:00
is_implicitly_default_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_integral P0482R5 char8_t: Updates to existing standard library tests 2019-02-22 01:16:08 +00:00
is_invocable Update copyright years. 2019-01-01 13:31:55 +01:00
is_literal_type Update copyright years. 2019-01-01 13:31:55 +01:00
is_lvalue_reference Update copyright years. 2019-01-01 13:31:55 +01:00
is_member_function_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
is_member_object_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
is_member_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
is_move_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_move_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_convertible Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r 2019-05-14 15:39:58 +01:00
is_nothrow_copy_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_copy_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_default_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_destructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_invocable Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r 2019-05-14 15:39:58 +01:00
is_nothrow_move_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_move_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_swappable Update copyright years. 2019-01-01 13:31:55 +01:00
is_nothrow_swappable_with Update copyright years. 2019-01-01 13:31:55 +01:00
is_null_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
is_object Update copyright years. 2019-01-01 13:31:55 +01:00
is_pod Update copyright years. 2019-01-01 13:31:55 +01:00
is_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
is_polymorphic Update copyright years. 2019-01-01 13:31:55 +01:00
is_reference Update copyright years. 2019-01-01 13:31:55 +01:00
is_rvalue_reference Update copyright years. 2019-01-01 13:31:55 +01:00
is_same Update copyright years. 2019-01-01 13:31:55 +01:00
is_scalar Update copyright years. 2019-01-01 13:31:55 +01:00
is_signed Update copyright years. 2019-01-01 13:31:55 +01:00
is_standard_layout Update copyright years. 2019-01-01 13:31:55 +01:00
is_swappable Update copyright years. 2019-01-01 13:31:55 +01:00
is_swappable_with Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivial Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_copy_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_copy_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_copyable Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_default_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_destructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_move_assignable Update copyright years. 2019-01-01 13:31:55 +01:00
is_trivially_move_constructible Update copyright years. 2019-01-01 13:31:55 +01:00
is_unbounded_array Add feature test macro for bounded array traits 2019-03-06 15:31:06 +00:00
is_union Update copyright years. 2019-01-01 13:31:55 +01:00
is_unsigned Update copyright years. 2019-01-01 13:31:55 +01:00
is_void Update copyright years. 2019-01-01 13:31:55 +01:00
is_volatile Update copyright years. 2019-01-01 13:31:55 +01:00
logical_traits Update copyright years. 2019-01-01 13:31:55 +01:00
make_signed/requirements P0482R5 char8_t: Updates to existing standard library tests 2019-02-22 01:16:08 +00:00
make_unsigned/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
memory_resource Update copyright years. 2019-01-01 13:31:55 +01:00
monotonic_buffer_resource Update copyright years. 2019-01-01 13:31:55 +01:00
move Update copyright years. 2019-01-01 13:31:55 +01:00
move_if_noexcept Update copyright years. 2019-01-01 13:31:55 +01:00
optional Add constexpr to std::optional::value_or(U&&)&& 2019-04-17 14:13:30 +01:00
owner_less Update copyright years. 2019-01-01 13:31:55 +01:00
pair Update copyright years. 2019-01-01 13:31:55 +01:00
pointer_safety Update copyright years. 2019-01-01 13:31:55 +01:00
pointer_traits Constexpr in std::pointer_traits (P1006R1) 2019-03-06 11:32:42 +00:00
polymorphic_allocator Tweak C++2a uses-allocator construction utilities 2019-04-26 14:15:54 +01:00
rank Update copyright years. 2019-01-01 13:31:55 +01:00
ratio Improve API docs for <chrono> and <ratio> 2019-05-07 23:46:53 +01:00
raw_storage_iterator Update copyright years. 2019-01-01 13:31:55 +01:00
reference_wrapper Fix tests that fail in C++2a mode 2019-01-29 00:47:32 +00:00
remove_all_extents Update copyright years. 2019-01-01 13:31:55 +01:00
remove_const Update copyright years. 2019-01-01 13:31:55 +01:00
remove_cv Update copyright years. 2019-01-01 13:31:55 +01:00
remove_cvref Update copyright years. 2019-01-01 13:31:55 +01:00
remove_extent Update copyright years. 2019-01-01 13:31:55 +01:00
remove_pointer Update copyright years. 2019-01-01 13:31:55 +01:00
remove_reference Update copyright years. 2019-01-01 13:31:55 +01:00
remove_volatile Update copyright years. 2019-01-01 13:31:55 +01:00
result_of Update copyright years. 2019-01-01 13:31:55 +01:00
scoped_allocator Tweak C++2a uses-allocator construction utilities 2019-04-26 14:15:54 +01:00
shared_ptr PR c++/90047 - ICE with enable_if alias template. 2019-04-17 23:32:24 -04:00
specialized_algorithms Integrate C++17 parallel algorithms 2019-03-21 23:48:49 +00:00
steady_clock Update copyright years. 2019-01-01 13:31:55 +01:00
synchronized_pool_resource Update copyright years. 2019-01-01 13:31:55 +01:00
system_clock Update copyright years. 2019-01-01 13:31:55 +01:00
time_point P0972R0 <chrono> zero(), min(), and max() should be noexcept 2019-01-11 23:41:05 +00:00
time_point_cast Update copyright years. 2019-01-01 13:31:55 +01:00
to_address Update copyright years. 2019-01-01 13:31:55 +01:00
to_chars PR c++/90047 - ICE with enable_if alias template. 2019-04-17 23:32:24 -04:00
tuple Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r 2019-05-14 15:39:58 +01:00
type_identity/requirements Update copyright years. 2019-01-01 13:31:55 +01:00
typeindex Update copyright years. 2019-01-01 13:31:55 +01:00
underlying_type/requirements P0340R2 Making std::underlying_type SFINAE-friendly 2019-02-23 21:19:00 +00:00
unique_ptr LWG 2899 - Make is_move_constructible correct for unique_ptr 2019-05-14 12:17:11 +01:00
unsynchronized_pool_resource Update copyright years. 2019-01-01 13:31:55 +01:00
unwrap_reference Corrections for C++2a std::unwrap_reference traits 2019-04-23 11:27:14 +01:00
uses_allocator C++2a Utility functions to implement uses-allocator construction (P0591R4) 2019-03-01 13:50:36 +00:00
variant Fix tests that fail with _GLIBCXX_USE_CXX11_ABI=0 2019-04-26 16:02:02 +01:00
void_t Update copyright years. 2019-01-01 13:31:55 +01:00
weak_ptr Update copyright years. 2019-01-01 13:31:55 +01:00
rel_ops.cc Update copyright years. 2019-01-01 13:31:55 +01:00
temporary_buffer.cc Update copyright years. 2019-01-01 13:31:55 +01:00
variable_templates_for_traits.cc Update copyright years. 2019-01-01 13:31:55 +01:00