Files
gcc-reflection/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda1.C
Jason Merrill a4b4b1e3ac 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.
2020-01-28 16:45:22 -05:00

17 lines
242 B
C

// PR c++/93442
// { dg-do compile { target c++17 } }
struct bar {
int foo(){return 0;}
};
int foobar() {
if constexpr(true) {
return 0;
} else {
return [](){
return bar{};
}().foo();
}
}