https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116710
--- Comment #1 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:8161c4adea7f1842f9d28633d82e912ebb7a4cf9 commit r15-4366-g8161c4adea7f1842f9d28633d82e912ebb7a4cf9 Author: Patrick Palka <ppa...@redhat.com> Date: Tue Oct 15 13:23:17 2024 -0400 c++: unifying lvalue vs rvalue (non-forwarding) ref [PR116710] When unifying two (non-forwarding) reference types, unify immediately recurses into the referenced type without first comparing rvalueness. (Note that at this point forwarding references and other reference parameters have already been stripped to their referenced type by maybe_adjust_types_for_deduction, so this code path applies only to nested reference types.) PR c++/116710 gcc/cp/ChangeLog: * pt.cc (unify) <case REFERENCE_TYPE>: Compare rvalueness. gcc/testsuite/ChangeLog: * g++.dg/template/unify12.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>