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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Nathaniel Shead
<nsh...@gcc.gnu.org>:

https://gcc.gnu.org/g:a82352a2a074230d841a3944e30bd497726e0bfa

commit r14-11233-ga82352a2a074230d841a3944e30bd497726e0bfa
Author: Nathaniel Shead <nathanielosh...@gmail.com>
Date:   Fri Jan 17 21:29:08 2025 +1100

    c++/modules: Propagate FNDECL_USED_AUTO when propagating deduced return
types [PR118049]

    In the linked testcase, we're erroring because the declared return types
    of the functions do not appear to match.  This is because when merging
    the deduced return types for 'foo' in 'auto-5_b.C', we overwrote the
    return type for the declaration with the deduced return type from
    'auto-5_a.C' but neglected to track that we were originally declared
    with 'auto'.

    As a drive-by improvement to QOI, also add checks for if the deduced
    return types do not match; this is currently useful because we do not
    check the equivalence of the bodies of functions yet.

            PR c++/118049

    gcc/cp/ChangeLog:

            * module.cc (trees_in::is_matching_decl): Propagate
            FNDECL_USED_AUTO as well.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/auto-5_a.C: New test.
            * g++.dg/modules/auto-5_b.C: New test.
            * g++.dg/modules/auto-5_c.C: New test.
            * g++.dg/modules/auto-6_a.H: New test.
            * g++.dg/modules/auto-6_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanielosh...@gmail.com>
    (cherry picked from commit f054c36c4fcb693e04411dc691ef4172479143d6)

Reply via email to