https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114795
--- Comment #8 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:4f9401d1a802325e5dfa2db841945e1a9c59a980 commit r14-10096-g4f9401d1a802325e5dfa2db841945e1a9c59a980 Author: Patrick Palka <ppa...@redhat.com> Date: Tue Apr 23 14:01:22 2024 -0400 c++/modules: deduced return type merging [PR114795] When merging an imported function template specialization with an existing one, if the existing one has an undeduced return type and the imported one's is already deduced, we need to propagate the deduced type since once we install the imported definition we won't get a chance to deduce it by normal means. So this patch makes is_matching_decl propagate the deduced return type alongside our propagation of the exception specification. Another option would be to propagate it later when installing the imported definition from read_function_def, but it seems preferable to do it sooner rather than later. PR c++/114795 gcc/cp/ChangeLog: * module.cc (trees_in::is_matching_decl): Propagate deduced function return type. gcc/testsuite/ChangeLog: * g++.dg/modules/auto-4_a.H: New test. * g++.dg/modules/auto-4_b.C: New test. Reviewed-by: Jason Merrill <ja...@redhat.com>