Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expr.prim.lambda.closure] p3 What is the return type of a function call operator(template) if trailing-return-type is omitted? #5400

Closed
xmh0511 opened this issue Apr 20, 2022 · 0 comments · Fixed by #5405
Assignees

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Apr 20, 2022

[expr.prim.lambda.closure] p3 says

The closure type for a lambda-expression has a public inline function call operator (for a non-generic lambda) or function call operator template (for a generic lambda) ([over.call]) whose parameters and return type are described by the lambda-expression's parameter-declaration-clause and trailing-return-type respectively, and whose template-parameter-list consists of the specified template-parameter-list, if any.

we just mention the case where trailing-return-type is omitted in [expr.prim.lambda.general] p5

If the lambda-declarator does not include a trailing-return-type, the lambda return type is auto,

we didn't explicitly associate the return type of the function call operator(template) of a lambda with the lambda return type. we merely defined the return type of the function call operator(template) as determined from the trailing-return-type.

I think we should change [expr.prim.lambda.general] p5 to

If the lambda-declarator does not include a trailing-return-type, it is as if its trailing-return-type is ->auto.

I also think saying lambda return type does not make sense. Since a lambda expression is a prvalue of a closure type and only the function call operator(template) of its closure type has a return type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants