Skip to content

Commit ac2196b

Browse files
authored
Add passing styles to single type return (#1274)
Resolves #1205 Suggestion 1, suggest making new elements for 2 and 3. Signed-off-by: gregmarr <[email protected]>
1 parent 8879d13 commit ac2196b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/cpp2/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ wrap_f: (
7878

7979
A function can return either of the following. The default is `#!cpp -> void`.
8080

81-
(1) **`#!cpp -> X`** to return a single unnamed value of type `X`, which can be `#!cpp void` to signify the function has no return value. If `X` is not `#!cpp void`, the function body must have a `#!cpp return /*value*/;` statement that returns a value of type `X` on every path that exits the function.
81+
(1) **`#!cpp -> X`** to return a single unnamed value of type `X` using the same passing styles from the [parameters](#parameters) syntax, but where the only passing styles are `move` (the default) or `forward`. The type can be `#!cpp void` to signify the function has no return value. If `X` is not `#!cpp void`, the function body must have a `#!cpp return /*value*/;` statement that returns a value of type `X` on every path that exits the function.
8282

8383
To deduce the return type, write `-> _`. A function whose body returns a single expression `expr` can deduce the return type, and omit writing the leading `-> _ = { return` and trailing `; }`.
8484

0 commit comments

Comments
 (0)