Open leni536 opened 1 year ago
It seems that we should cover both subexpressions and constituent expressions.
Is it clear enough to say the following?
Temporary objects are destroyed as the last step in evaluating the full-expression ([intro.execution]) ~that (lexically) contains the point where they were created~ of the temporary materialization conversions ([conv.rval]) that initialized the temporary objects.
It seems that we should cover both subexpressions and constituent expressions.
You are probably right
Is it clear enough to say the following?
Temporary objects are destroyed as the last step in evaluating the full-expression ([intro.execution]) ~that (lexically) contains the point where they were created~ of the temporary materialization conversions ([conv.rval]) that initialized the temporary objects.
What's a "full-expression of
Alternatively the following wording could be used.
As the last step in evaluating a full-expression the temporaries that are initialized [conv.rval] in subexpressions or constituent expressions of the full-expression are destroyed.
Current wording
https://github.com/cplusplus/draft/blob/16c8ce5db2173a098a91e552dcfa3544c67e544f/source/basic.tex#L4379-L4383
As far as I know "(lexically) contained" is not defined.
The presence of "lexically" here is especially confusing in the light of this note:
https://github.com/cplusplus/draft/blob/16c8ce5db2173a098a91e552dcfa3544c67e544f/source/basic.tex#L5824-L5831
Intent
I think the intent is pretty clear in light of the subexpression wording and corresponding examples that the lifetime of a temporary should be solely be determined by the corresponding full-expression of the temporary materialization conversion subexpression that initialized it. Any "lexical" relationship is incidental.
Suggested wording
I think the [class.temporary] wording can be expressed purely with subexpressions, like so: