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

--- Comment #4 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:2a908f3da07c9e94b8a19e966b45daf0140107e8

commit r12-6846-g2a908f3da07c9e94b8a19e966b45daf0140107e8
Author: Patrick Palka <ppa...@redhat.com>
Date:   Mon Jan 24 09:17:35 2022 -0500

    c++: value category of compound object expr [PR104173]

    Here the call to (the &&-qualified) toLower() is incorrectly rejected
    during overload resolution because the object expression is encoded as
    an lvalue when it's really a prvalue.  The object expression,
    instance()->applicationName(), is encoded as an INDIRECT_REF of a
    COMPOUND_EXPR

      *(*instance ();, &TARGET_EXPR <D.2383, QCoreApplication::applicationName
()>;);

    which lvalue_kind deems an lvalue.

    This issue is similar to PR88103 except that here the original compound
    object expression is a prvalue rather than an xvalue.  The fix there was to
    adjust the result of unary_complex_lvalue in build_class_member_access_expr
    so that xvalueness of the original expression is preserved.  This patch
    extends that fix so that rvalueness is preserved more generally.

            PR c++/104173

    gcc/cp/ChangeLog:

            * typeck.cc (build_class_member_access_expr): Extend
            unary_complex_lvalue result adjustment to preserve all
            rvalues, not just xvalues.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/ref-qual21.C: New test.

Reply via email to