Skip to content

Commit d8429c2

Browse files
pbackusdlang-bot
authored andcommitted
Allow lambdas to return auto ref
Bugzilla: https://issues.dlang.org/show_bug.cgi?id=21243 DMD PR: dlang/dmd#14454
1 parent e6c209c commit d8429c2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

spec/expression.dd

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,9 +1894,9 @@ $(H3 $(LNAME2 function_literals, Function Literals))
18941894

18951895
$(GRAMMAR
18961896
$(GNAME FunctionLiteral):
1897-
$(D function) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1898-
$(D delegate) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1899-
$(D ref)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody2)
1897+
$(D function) $(GLINK RefOrAutoRef)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1898+
$(D delegate) $(GLINK RefOrAutoRef)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody2)
1899+
$(GLINK RefOrAutoRef)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody2)
19001900
$(GLINK2 statement, BlockStatement)
19011901
$(IDENTIFIER) $(D =>) $(GLINK AssignExpression)
19021902

@@ -1909,6 +1909,10 @@ $(GNAME ParameterWithMemberAttributes):
19091909
$(GNAME FunctionLiteralBody2):
19101910
$(D =>) $(GLINK AssignExpression)
19111911
$(GLINK2 function, SpecifiedFunctionBody)
1912+
1913+
$(GNAME RefOrAutoRef):
1914+
$(D ref)
1915+
$(D auto ref)
19121916
)
19131917

19141918
$(P $(I FunctionLiteral)s (also known as $(LNAME2 lambdas, $(I Lambdas))) enable embedding anonymous functions

0 commit comments

Comments
 (0)