[Bug c++/96311] [9/10 Regression] false positive for -Wunused-but-set-variable (const/constexpr identifier used in generic lambda)

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 20 21:35:11 GMT 2021


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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:8909ed58700694f5ba66499739edfea90a0fc813

commit r10-9846-g8909ed58700694f5ba66499739edfea90a0fc813
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 5 16:22:51 2021 -0400

    c++: -Wunused, constant, and generic lambda [PR96311]

    We never called mark_use for a return value in a function with dependent
    return type.  In that situation we don't know if the use is as an rvalue or
    lvalue, but we can use mark_exp_read instead.

    gcc/cp/ChangeLog:

            PR c++/96311
            * typeck.c (check_return_expr): Call mark_exp_read in dependent
            case.

    gcc/testsuite/ChangeLog:

            PR c++/96311
            * g++.dg/cpp1y/lambda-generic-Wunused.C: New test.


More information about the Gcc-bugs mailing list