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

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

commit r12-5403-gfd740165e54151ea794fca34904f5c2e2ea1dcda
Author: Patrick Palka <ppa...@redhat.com>
Date:   Fri Nov 19 08:54:25 2021 -0500

    c++: nested lambda capturing a capture proxy [PR94376]

    Here when determining the type of the FIELD_DECL for the by-value capture
    of 'i' in the inner lambda, we incorrectly give it the type const int
    instead of int since the effective initializer is the proxy for the outer
    capture, and this proxy is const since the outer lambda is non-mutable.

    This patch fixes this by making lambda_capture_field_type handle
    by-value capturing of capture proxies specially, namely we instead
    consider the type of their FIELD_DECL which unlike the proxy has the
    true cv-quals of the captured entity.

            PR c++/94376

    gcc/cp/ChangeLog:

            * lambda.c (lambda_capture_field_type): Simplify by handling the
            is_this case first.  When capturing by-value a capture proxy,
            consider the type of the corresponding field instead.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-nested9.C: New test.
  • [Bug c++/94376] When nested ins... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to