Skip to content

Commit d5234f5

Browse files
[stmt.return] Fix operand conversions description
1 parent 1c5f448 commit d5234f5

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

source/declarations.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4347,7 +4347,7 @@
43474347
The initialization that occurs in the \tcode{=} form of a
43484348
\grammarterm{brace-or-equal-initializer} or
43494349
\grammarterm{condition}\iref{stmt.select},
4350-
as well as in argument passing, function return,
4350+
as well as in argument passing,
43514351
throwing an exception\iref{except.throw},
43524352
handling an exception\iref{except.handle},
43534353
and aggregate member initialization\iref{dcl.init.aggr},

source/statements.tex

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,11 +826,17 @@
826826
A \tcode{return} statement with an operand of type \tcode{void} shall be used only
827827
in a function whose return type is \cv{}~\tcode{void}.
828828
A \tcode{return} statement with any other operand shall be used only
829-
in a function whose return type is not \cv{}~\tcode{void};
829+
in a function whose return type is not \cv{}~\tcode{void}.
830+
831+
\pnum
830832
\indextext{conversion!return type}%
831-
the \tcode{return} statement initializes the
832-
glvalue result or prvalue result object of the (explicit or implicit) function call
833-
by copy-initialization\iref{dcl.init} from the operand.
833+
The sequence of conversions applied to the operand of the \tcode{return} statement
834+
is the same as if the parenthesized operand was used to copy-initialize\iref{dcl.init}
835+
a hypothetical variable having the same type as the return type of the function
836+
containing the \tcode{return} statement,
837+
except that if the operand is a prvalue having the same type as the return type,
838+
ignoring the top-level \grammarterm{cv-qualifier}{s},
839+
the temporary materialization conversion\iref{conv.rval} is not applied.
834840
\begin{note}
835841
A \tcode{return} statement can involve
836842
an invocation of a constructor to perform a copy or move of the operand

0 commit comments

Comments
 (0)