https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120717
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:bc8f5424977b74e107543b34af00768cdbb3a3cf commit r16-1653-gbc8f5424977b74e107543b34af00768cdbb3a3cf Author: Patrick Palka <ppa...@redhat.com> Date: Tue Jun 24 09:33:25 2025 -0400 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 <tkami...@redhat.com> Co-authored-by: Jonathan Wakely <jwak...@redhat.com> Reviewed-by: Jonathan Wakely <jwak...@redhat.com>