@@ -7516,15 +7516,18 @@ class parser
7516
7516
}
7517
7517
7518
7518
7519
- // If we're not at a '->' and what follows is an expression-statement,
7520
- // this is a ":(params) expr;" shorthand function syntax
7521
- if (curr ().type () != lexeme::Arrow)
7519
+ // If we're not at a '->' or 'requires' and what follows is an expression,
7520
+ // this is a ":(params) expr" shorthand function syntax
7521
+ if (
7522
+ curr ().type () != lexeme::Arrow
7523
+ && curr () != " requires"
7524
+ )
7522
7525
{
7523
7526
auto start_pos = pos;
7524
- auto at_an_expression_statement = expression_statement ( true ) != nullptr ;
7527
+ auto at_an_expression = expression ( ) != nullptr ;
7525
7528
pos = start_pos; // backtrack no matter what, we're just peeking here
7526
7529
7527
- if (at_an_expression_statement ) {
7530
+ if (at_an_expression ) {
7528
7531
n->returns = function_type_node::single_type_id{ std::make_unique<type_id_node>() };
7529
7532
assert (n->returns .index () == function_type_node::id);
7530
7533
n->my_decl ->terse_no_equals = true ;
@@ -7903,7 +7906,7 @@ class parser
7903
7906
if (n->terse_no_equals )
7904
7907
{
7905
7908
n->equal_sign = curr ().position ();
7906
- n->initializer = statement (/* ignore semicolon_required*/ true , n->equal_sign );
7909
+ n->initializer = statement (/* ignore semicolon_required*/ false , n->equal_sign );
7907
7910
assert ( n->initializer && " ICE: should have already validated that there's a valid expression-statement here" );
7908
7911
}
7909
7912
0 commit comments