c++: -Wunused, constant, and generic lambda [PR96311]
authorJason Merrill <jason@redhat.com>
Mon, 5 Apr 2021 20:22:51 +0000 (16:22 -0400)
committerJason Merrill <jason@redhat.com>
Mon, 5 Apr 2021 21:27:24 +0000 (17:27 -0400)
commitb07dd9b0d0e501a0083da79e2bca17041c007ec8
tree7743419cf93ae59b0356f81b9cfc70f04b95896f
parent07f56824fd4da14a48030e698c8eb58de951c741
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.
gcc/cp/typeck.c
gcc/testsuite/g++.dg/cpp1y/lambda-generic-Wunused.C [new file with mode: 0644]