https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125697
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Marek Polacek <[email protected]>: https://gcc.gnu.org/g:49ba5321b3586c076728ad34ed7030c5a472c892 commit r17-1757-g49ba5321b3586c076728ad34ed7030c5a472c892 Author: Marek Polacek <[email protected]> Date: Wed Jun 10 16:43:18 2026 -0400 c++: fix spurious -Wrange-loop-construct warning [PR125697] Here we issue a bogus -Wrange-loop-construct warning because the is_trivially_xible check uses `const pair<int>` which makes it seem like `pair<T>::pair(const pair<_U1> &&)` would actually be used, which is non-trivial, while the loop would actually use a trivial copy. Fixed by using `const pair<int> &` for the is_trivially_xible check. PR c++/125697 gcc/cp/ChangeLog: * cp-tree.h (trivially_copy_constructible_p): Declare. * parser.cc (warn_for_range_copy): Use it. * reflect.cc (eval_is_trivially_copy_constructible_type): Use it. * tree.cc (trivially_copy_constructible_p): New. gcc/ChangeLog: * doc/invoke.texi: Clarify -Wrange-loop-construct description. gcc/testsuite/ChangeLog: * g++.dg/warn/Wrange-loop-construct4.C: New test. Reviewed-by: Jason Merrill <[email protected]>
