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

--- Comment #20 from CVS 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:6ab1176667734bd6de20833f8d263c03a418c452

commit r12-702-g6ab1176667734bd6de20833f8d263c03a418c452
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon May 10 22:38:34 2021 -0400

    c++: dependent operator expression lookup [PR51577]

    This unconditionally enables the maybe_save_operator_binding mechanism
    for all function templates, so that when resolving a dependent operator
    expression from a function template we ignore later-declared
    namespace-scope bindings that weren't visible at template definition
    time.  This patch additionally makes the mechanism apply to dependent
    comma and compound-assignment operator expressions.

    Note that this doesn't fix the testcases in PR83035 or PR99692 because
    there the dependent operator expressions aren't at function scope.  I'm
    not sure how adapt this mechanism for these testcases, since although
    we'll in both testcases have a TEMPLATE_DECL to associate the lookup
    result with, at instantiation time we won't have an appropriate binding
    level to push to.

    gcc/cp/ChangeLog:

            PR c++/51577
            * name-lookup.c (maybe_save_operator_binding): Unconditionally
            enable for all function templates, not just generic lambdas.
            Handle compound-assignment operator expressions.
            * typeck.c (build_x_compound_expr): Call
maybe_save_operator_binding
            in the type-dependent case.
            (build_x_modify_expr): Likewise.  Move declaration of 'op' closer
            to its first use.

    gcc/testsuite/ChangeLog:

            PR c++/51577
            * g++.dg/lookup/operator-3.C: New test.

Reply via email to