gcc/libstdc++-v3/testsuite/20_util
Patrick Palka bc8f542497 libstdc++: Unnecessary type completion in __is_complete_or_unbounded [PR120717]
When checking __is_complete_or_unbounded on a reference to incomplete
type, we overeagerly try to instantiate/complete the referenced type
which besides being unnecessary may also produce an unexpected
-Wsfinae-incomplete warning (added in r16-1527) if the referenced type
is later defined.

This patch fixes this by effectively restricting the sizeof check to
object (except unknown-bound array) types.  In passing simplify the
implementation by using is_object instead of is_function/reference/void
and introducing a __maybe_complete_object_type helper.

	PR libstdc++/120717

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__maybe_complete_object_type): New
	helper trait, factored out from ...
	(__is_complete_or_unbounded): ... here.  Only check sizeof on a
	__maybe_complete_object_type type.  Fix formatting.
	* testsuite/20_util/is_complete_or_unbounded/120717.cc: New test.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
2025-06-24 09:33:25 -04:00
..
add_const Update copyright years. 2025-01-02 11:59:57 +01:00
add_cv Update copyright years. 2025-01-02 11:59:57 +01:00
add_lvalue_reference Update copyright years. 2025-01-02 11:59:57 +01:00
add_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
add_rvalue_reference Update copyright years. 2025-01-02 11:59:57 +01:00
add_volatile Update copyright years. 2025-01-02 11:59:57 +01:00
addressof Update copyright years. 2025-01-02 11:59:57 +01:00
align Update copyright years. 2025-01-02 11:59:57 +01:00
aligned_storage libstdc++: [_GLIBCXX_INLINE_VERSION] Fix tests failures 2025-04-30 07:23:43 +02:00
aligned_union Update copyright years. 2025-01-02 11:59:57 +01:00
alignment_of Update copyright years. 2025-01-02 11:59:57 +01:00
allocator Update copyright years. 2025-01-02 11:59:57 +01:00
allocator_traits Update copyright years. 2025-01-02 11:59:57 +01:00
any Update copyright years. 2025-01-02 11:59:57 +01:00
as_const Update copyright years. 2025-01-02 11:59:57 +01:00
assume_aligned Update copyright years. 2025-01-02 11:59:57 +01:00
auto_ptr Update copyright years. 2025-01-02 11:59:57 +01:00
bad_function_call Update copyright years. 2025-01-02 11:59:57 +01:00
bind Update copyright years. 2025-01-02 11:59:57 +01:00
bitset Update copyright years. 2025-01-02 11:59:57 +01:00
bool_constant Update copyright years. 2025-01-02 11:59:57 +01:00
common_reference Update copyright years. 2025-01-02 11:59:57 +01:00
common_type/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
conditional/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
copyable_function libstdc++: Pass small trivial types by value in polymorphic wrappers 2025-06-02 13:52:35 +02:00
decay/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
declval/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
default_delete Update copyright years. 2025-01-02 11:59:57 +01:00
duration Update copyright years. 2025-01-02 11:59:57 +01:00
duration_cast Update copyright years. 2025-01-02 11:59:57 +01:00
enable_if/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
enable_shared_from_this Update copyright years. 2025-01-02 11:59:57 +01:00
exchange Update copyright years. 2025-01-02 11:59:57 +01:00
expected libstdc++: Fix constraint recursion in std::expected's operator== [PR119714] 2025-05-12 09:15:34 -04:00
extent Update copyright years. 2025-01-02 11:59:57 +01:00
forward Update copyright years. 2025-01-02 11:59:57 +01:00
forward_like libstdc++: use concrete return type for std::forward_like 2024-08-03 09:05:05 -04:00
from_chars Update copyright years. 2025-01-02 11:59:57 +01:00
function libstdc++: [_GLIBCXX_INLINE_VERSION] Fix tests failures 2025-04-30 07:23:43 +02:00
function_objects Update copyright years. 2025-01-02 11:59:57 +01:00
function_ref libstdc++: Pass small trivial types by value in polymorphic wrappers 2025-06-02 13:52:35 +02:00
has_unique_object_representations Update copyright years. 2025-01-02 11:59:57 +01:00
has_virtual_destructor Update copyright years. 2025-01-02 11:59:57 +01:00
hash Update copyright years. 2025-01-02 11:59:57 +01:00
headers libstdc++: Add missing feature-test macro in <memory> 2025-05-02 11:54:20 +01:00
in_place Update copyright years. 2025-01-02 11:59:57 +01:00
integer_comparisons Update copyright years. 2025-01-02 11:59:57 +01:00
integer_sequence Update copyright years. 2025-01-02 11:59:57 +01:00
integral_constant Update copyright years. 2025-01-02 11:59:57 +01:00
invoke_result Update copyright years. 2025-01-02 11:59:57 +01:00
is_abstract Update copyright years. 2025-01-02 11:59:57 +01:00
is_aggregate Update copyright years. 2025-01-02 11:59:57 +01:00
is_arithmetic Update copyright years. 2025-01-02 11:59:57 +01:00
is_array Update copyright years. 2025-01-02 11:59:57 +01:00
is_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_base_of Update copyright years. 2025-01-02 11:59:57 +01:00
is_bounded_array Update copyright years. 2025-01-02 11:59:57 +01:00
is_class Update copyright years. 2025-01-02 11:59:57 +01:00
is_complete_or_unbounded libstdc++: Unnecessary type completion in __is_complete_or_unbounded [PR120717] 2025-06-24 09:33:25 -04:00
is_compound Update copyright years. 2025-01-02 11:59:57 +01:00
is_const Update copyright years. 2025-01-02 11:59:57 +01:00
is_constant_evaluated Update copyright years. 2025-01-02 11:59:57 +01:00
is_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_convertible Update copyright years. 2025-01-02 11:59:57 +01:00
is_copy_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_copy_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_default_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_destructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_empty Update copyright years. 2025-01-02 11:59:57 +01:00
is_enum Update copyright years. 2025-01-02 11:59:57 +01:00
is_final Update copyright years. 2025-01-02 11:59:57 +01:00
is_floating_point Update copyright years. 2025-01-02 11:59:57 +01:00
is_function Update copyright years. 2025-01-02 11:59:57 +01:00
is_fundamental Update copyright years. 2025-01-02 11:59:57 +01:00
is_implicitly_default_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_integral Update copyright years. 2025-01-02 11:59:57 +01:00
is_invocable Update copyright years. 2025-01-02 11:59:57 +01:00
is_layout_compatible libstdc++: Test for feature test macros more accurately 2023-11-16 08:06:59 +00:00
is_literal_type Update copyright years. 2025-01-02 11:59:57 +01:00
is_lvalue_reference Update copyright years. 2025-01-02 11:59:57 +01:00
is_member_function_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
is_member_object_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
is_member_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
is_move_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_move_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_convertible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_copy_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_copy_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_default_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_destructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_invocable Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_move_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_move_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_swappable Update copyright years. 2025-01-02 11:59:57 +01:00
is_nothrow_swappable_with Update copyright years. 2025-01-02 11:59:57 +01:00
is_null_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
is_object Update copyright years. 2025-01-02 11:59:57 +01:00
is_pod Update copyright years. 2025-01-02 11:59:57 +01:00
is_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
is_pointer_interconvertible libstdc++: Test for feature test macros more accurately 2023-11-16 08:06:59 +00:00
is_polymorphic Update copyright years. 2025-01-02 11:59:57 +01:00
is_reference Update copyright years. 2025-01-02 11:59:57 +01:00
is_rvalue_reference Update copyright years. 2025-01-02 11:59:57 +01:00
is_same Update copyright years. 2025-01-02 11:59:57 +01:00
is_scalar Update copyright years. 2025-01-02 11:59:57 +01:00
is_scoped_enum Update copyright years. 2025-01-02 11:59:57 +01:00
is_signed Update copyright years. 2025-01-02 11:59:57 +01:00
is_standard_layout Update copyright years. 2025-01-02 11:59:57 +01:00
is_swappable Update copyright years. 2025-01-02 11:59:57 +01:00
is_swappable_with Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivial Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_copy_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_copy_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_copyable Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_default_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_destructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_move_assignable Update copyright years. 2025-01-02 11:59:57 +01:00
is_trivially_move_constructible Update copyright years. 2025-01-02 11:59:57 +01:00
is_unbounded_array Update copyright years. 2025-01-02 11:59:57 +01:00
is_union Update copyright years. 2025-01-02 11:59:57 +01:00
is_unsigned Update copyright years. 2025-01-02 11:59:57 +01:00
is_virtual_base_of libstdc++: add std::is_virtual_base_of 2024-10-05 14:34:29 -04:00
is_void Update copyright years. 2025-01-02 11:59:57 +01:00
is_volatile Update copyright years. 2025-01-02 11:59:57 +01:00
logical_traits Update copyright years. 2025-01-02 11:59:57 +01:00
make_signed/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
make_unsigned/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
memory_resource Update copyright years. 2025-01-02 11:59:57 +01:00
monostate libstdc++: Move std::monostate to <utility> for C++26 (P0472R2) 2024-11-30 21:39:16 +00:00
monotonic_buffer_resource Update copyright years. 2025-01-02 11:59:57 +01:00
move Update copyright years. 2025-01-02 11:59:57 +01:00
move_if_noexcept Update copyright years. 2025-01-02 11:59:57 +01:00
move_only_function libstdc++: Pass small trivial types by value in polymorphic wrappers 2025-06-02 13:52:35 +02:00
nonesuch Update copyright years. 2025-01-02 11:59:57 +01:00
optional libstdc++: add range support to std::optional (P3168) 2025-06-12 18:29:37 +02:00
owner_less Update copyright years. 2025-01-02 11:59:57 +01:00
pair Update copyright years. 2025-01-02 11:59:57 +01:00
pointer_safety Update copyright years. 2025-01-02 11:59:57 +01:00
pointer_traits Update copyright years. 2025-01-02 11:59:57 +01:00
polymorphic_allocator Update copyright years. 2025-01-02 11:59:57 +01:00
rank Update copyright years. 2025-01-02 11:59:57 +01:00
ratio Update copyright years. 2025-01-02 11:59:57 +01:00
raw_storage_iterator Update copyright years. 2025-01-02 11:59:57 +01:00
reference_from_temporary Update copyright years. 2025-01-02 11:59:57 +01:00
reference_wrapper Update copyright years. 2025-01-02 11:59:57 +01:00
remove_all_extents Update copyright years. 2025-01-02 11:59:57 +01:00
remove_const Update copyright years. 2025-01-02 11:59:57 +01:00
remove_cv Update copyright years. 2025-01-02 11:59:57 +01:00
remove_cvref Update copyright years. 2025-01-02 11:59:57 +01:00
remove_extent Update copyright years. 2025-01-02 11:59:57 +01:00
remove_pointer Update copyright years. 2025-01-02 11:59:57 +01:00
remove_reference Update copyright years. 2025-01-02 11:59:57 +01:00
remove_volatile Update copyright years. 2025-01-02 11:59:57 +01:00
result_of Update copyright years. 2025-01-02 11:59:57 +01:00
scoped_allocator Update copyright years. 2025-01-02 11:59:57 +01:00
shared_ptr libstdc++: centralize and improve testing of shared_ptr/weak_ptr conversions 2025-04-29 00:38:59 +02:00
smartptr.adapt libstdc++: Add test for LWG Issue 3897 2023-12-05 16:40:43 +00:00
specialized_algorithms libstdc++: Fix std::uninitialized_value_construct for arrays [PR120397] 2025-06-13 16:35:20 +01:00
stdbit libstdc++: Make <stdbit.h> test use <climits> instead of <limits.h> 2025-03-19 20:59:54 +00:00
steady_clock Update copyright years. 2025-01-02 11:59:57 +01:00
synchronized_pool_resource Update copyright years. 2025-01-02 11:59:57 +01:00
system_clock libstdc++: Make system_clock::to_time_t always_inline [PR99832] 2025-06-04 20:15:44 +01:00
time_point Update copyright years. 2025-01-02 11:59:57 +01:00
time_point_cast Update copyright years. 2025-01-02 11:59:57 +01:00
to_address Update copyright years. 2025-01-02 11:59:57 +01:00
to_chars libstdc++-v3 testsuite: fix malformed dg-require-static-libstdcxx directives 2025-03-27 20:00:34 -04:00
to_underlying Update copyright years. 2025-01-02 11:59:57 +01:00
tuple libstdc++: Implement LWG3528 make_from_tuple can perform (the equivalent of) a C-style cast 2025-06-10 14:28:55 +01:00
type_identity/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
typeindex Update copyright years. 2025-01-02 11:59:57 +01:00
underlying_type/requirements Update copyright years. 2025-01-02 11:59:57 +01:00
unique_ptr libstdc++: Prevent dangling references in std::unique_ptr::operator* 2025-03-12 10:12:36 +00:00
unreachable libstdc++: Test for feature test macros more accurately 2023-11-16 08:06:59 +00:00
unsynchronized_pool_resource Update copyright years. 2025-01-02 11:59:57 +01:00
unwrap_reference Update copyright years. 2025-01-02 11:59:57 +01:00
uses_allocator Update copyright years. 2025-01-02 11:59:57 +01:00
variant Update copyright years. 2025-01-02 11:59:57 +01:00
void_t Update copyright years. 2025-01-02 11:59:57 +01:00
weak_ptr libstdc++: centralize and improve testing of shared_ptr/weak_ptr conversions 2025-04-29 00:38:59 +02:00
rel_ops.cc Update copyright years. 2025-01-02 11:59:57 +01:00
temporary_buffer.cc Update copyright years. 2025-01-02 11:59:57 +01:00
variable_templates_for_traits.cc Update copyright years. 2025-01-02 11:59:57 +01:00