cplusplus / cplusplus/draft

[class.temporary] Clarify wording for lifetime of temporaries.

Open
#6,562 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

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:

At the end of a full-expression temporaries that are initialized by temporary materialization conversion [conv.rval] subexpressions are destroyed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read source/basic.tex around the linked [class.temporary] wording and compare it with the note around the second linked location. Check the suggested subexpression-based wording against the surrounding examples and terminology. Done means the lifetime rule no longer relies on unclear “lexically contained” wording and remains consistent with the cited material.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, tex
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.