cplusplus / CWG

Core Working Group
24 stars 7 forks source link

[defns] Lambda expressions and requires expressions have no parameters #414

Open Eisenwave opened 1 year ago

Eisenwave commented 1 year ago

Reference (section label): [defns]

Issue Description

Lambda expressions and requires expressions have a parameter-declaration-clause and the wording (e.g. use of "parameter" in [expr.prim.req.general] p4) suggests that they have parameters. However, [defns.parameter] doesn't match that intuition.

Furthermore, in [defns.parameter], unlike in [defns.parameter.templ], non-grammatical wording like "catch clause" is used, where "catch clause" is not defined anywhere.

Suggested Resolution

Update [defns.parameter] as follows:

-⟨function or catch clause⟩
+⟨function, handler, lambda expression, or requires expression⟩
 object or reference declared as part of a
-function declaration or definition or in the catch clause
-of an exception handler that acquires a value on entry to the function or handler
+*parameter-declaration-list*
+or in an *exception-declaration* of a *handler*

(*term* in the diff refers to grammatical terms)

frederick-vs-ja commented 1 year ago

It would be surprising that parameters of lambda expressions are not counted into function parameters. Can we make deduplication elsewhere?

jensmaurer commented 1 year ago

I'm ok with naming lambda expressions separately here, but I do want to keep "that acquires a value". I guess we need a new defn entry for parameters of requires-expressions (where there is no value).