You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise, if [...] then ranges::begin(E) is expression-equivalent to decay-copy(begin(t))
Expression-equivalent is defined in [defns.expression-equivalent]:
expressions that all have the same effects, either are all potentially-throwing (14.5) or are all not
potentially throwing, and either are all constant subexpressions or are all not constant subexpressions.
[Example: For a value x of type int and a function f that accepts integer arguments, the expressions f(x +2), f(2 + x), and f(1 + x + 1) are expression-equivalent. —end example]
But according to https://en.cppreference.com/w/cpp/language/copy_elision, only PRvalues are subject to guaranteed copy elision. So it is possible that in decay-copy(begin(t)), the elision of the copy of t is required, but for ranges::begin(E) copy elision may happen, but it is not required.
Therefore, they are not expression-equivalent expressions, as that term of power is currently specified.
The text was updated successfully, but these errors were encountered:
This is the issue tracker for editorial issues around the C++ standard. I'm not seeing anything we could fix as an editorial issue here (i.e.without changing the meaning of the standard). Defects in the definition of "expression-equivalent" should be directed to LWG, it seems.
jensmaurer
added
after-motions
Pull request is to be applied after the pending edits from WG21 straw polls have been applied.
lwg
Issue must be reviewed by LWG.
and removed
after-motions
Pull request is to be applied after the pending edits from WG21 straw polls have been applied.
labels
Oct 1, 2020
To take one example, [range.access.begin]/p2.5
Expression-equivalent is defined in [defns.expression-equivalent]:
But according to https://en.cppreference.com/w/cpp/language/copy_elision, only PRvalues are subject to guaranteed copy elision. So it is possible that in
decay-copy
(begin(t))
, the elision of the copy oft
is required, but forranges::begin(E)
copy elision may happen, but it is not required.Therefore, they are not expression-equivalent expressions, as that term of power is currently specified.
The text was updated successfully, but these errors were encountered: