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

--- Comment #19 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Patrick Palka
<ppa...@gcc.gnu.org>:

https://gcc.gnu.org/g:9499fe0403e310f4eb1f23279bff84259e120e76

commit r9-9453-g9499fe0403e310f4eb1f23279bff84259e120e76
Author: Patrick Palka <ppa...@redhat.com>
Date:   Wed Jul 29 22:06:44 2020 -0400

    c++: overload sets and placeholder return type [PR64194]

    In the testcase below, template argument deduction for the call
    g(id<int>) goes wrong because the functions in the overload set id<int>
    each have a yet-undeduced auto return type, and this undeduced return
    type makes try_one_overload fail to match up any of the overloads with
    g's parameter type, leading to g's template argument going undeduced and
    to the overload set going unresolved.

    This patch fixes this issue by performing return type deduction via
    instantiation before doing try_one_overload, in a manner similar to what
    resolve_address_of_overloaded_function does.

    gcc/cp/ChangeLog:

            PR c++/64194
            * pt.c (resolve_overloaded_unification): If the function
            template specialization has a placeholder return type,
            then instantiate it before attempting unification.

    gcc/testsuite/ChangeLog:

            PR c++/64194
            * g++.dg/cpp1y/auto-fn60.C: New test.

    (cherry picked from commit 2c58f5cadfac338a67723fd6e41c9097760c4a33)

Reply via email to