Skip to content

[stmt.return] Fix the operand's conversions description #4107

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4347,7 +4347,7 @@
The initialization that occurs in the \tcode{=} form of a
\grammarterm{brace-or-equal-initializer} or
\grammarterm{condition}\iref{stmt.select},
as well as in argument passing, function return,
as well as in argument passing,
throwing an exception\iref{except.throw},
handling an exception\iref{except.handle},
and aggregate member initialization\iref{dcl.init.aggr},
Expand Down
12 changes: 8 additions & 4 deletions source/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,15 @@
A \tcode{return} statement with an operand of type \tcode{void} shall be used only
in a function whose return type is \cv{}~\tcode{void}.
A \tcode{return} statement with any other operand shall be used only
in a function whose return type is not \cv{}~\tcode{void};
in a function whose return type is not \cv{}~\tcode{void}.

\pnum
\indextext{conversion!return type}%
the \tcode{return} statement initializes the
glvalue result or prvalue result object of the (explicit or implicit) function call
by copy-initialization\iref{dcl.init} from the operand.
The sequence of conversions applied to the operand of the \tcode{return} statement
is the same sequence which would be applied to the parenthesized operand,
if the parenthesized operand was used to copy-initialize\iref{dcl.init}
a hypothetical variable having the same type as the return type of the function
containing the \tcode{return} statement.
\begin{note}
A \tcode{return} statement can involve
an invocation of a constructor to perform a copy or move of the operand
Expand Down