c++: Fix return deduction of lambda in discarded stmt.
authorJason Merrill <jason@redhat.com>
Tue, 28 Jan 2020 21:06:33 +0000 (16:06 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 28 Jan 2020 21:45:22 +0000 (16:45 -0500)
commita4b4b1e3ac9a2c97f7550024c3cc5aff52e0614c
tree4fb1e60471d5ca75a6af4f96a45a526d40cae462
parent25d62480c89d6db90a66ba69f6dbaa820a1ac90b
c++: Fix return deduction of lambda in discarded stmt.

A return statement in a discarded statement is not used for return type
deduction, but we still want to do deduction for a return statement in a
lambda in a discarded statement.

PR c++/93442
* parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda1.C [new file with mode: 0644]