https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125115

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Patrick Palka
<[email protected]>:

https://gcc.gnu.org/g:8d53ff2967f9b449c5496d1bc488d457d1c2b2c7

commit r16-8853-g8d53ff2967f9b449c5496d1bc488d457d1c2b2c7
Author: Patrick Palka <[email protected]>
Date:   Fri May 1 12:38:25 2026 -0400

    c++/modules: merging fn w/ inst noexcept + deduced auto [PR125115]

    Here when streaming in view_interface<int>::data() and merging it with
    the in-TU version, we find that the streamed-in version already has its
    noexcept instantiated _and_ its return type deduced.  is_matching_decl
    has logic to update the in-TU version when that is the case, first by
    propagating the instantiated noexcept.  But this is done by overwriting
    the entire function type with the streamed-in one, which simultaneously
    updates the return type as well.  This premature return type updating
    breaks the later deduced return type checks which are partially in terms
    of the original function type.

    This patch fixes this by propagating the instantiated noexcept more
    narrowly via build_exception_variant.  Also turn e_type into a
    reference so that it's not stale after updating e_inner's TREE_TYPE.

            PR c++/125115

    gcc/cp/ChangeLog:

            * module.cc (trees_in::is_matching_decl): Turn e_type into a
            reference and use it instead of TREE_TYPE (e_inner).  Always
            use build_exception_variant to propagate an already-instantiated
            noexcept.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/auto-9.h: New test.
            * g++.dg/modules/auto-9_a.H: New test.
            * g++.dg/modules/auto-9_b.C: New test.

    Reviewed-by: Jason Merrill <[email protected]>
    (cherry picked from commit b4edbe6ff3393733c0bbe9717e0f5abd6775e5d3)

Reply via email to