cplusplus / cplusplus/draft

[basic.life]/6 and [basic.life]/7 Duplicate wording regarding access outside of lifetime

Open
#5,763 6 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

The wording for [basic.life]/6 and [basic.life]/7 is basically the same, except:

  • [basic.life]/6.2: the pointer is used to access a non-static data member or call a non-static member function of the object

is not the same as

  • [basic.life]/7.1: the glvalue is used to access the object
  • [basic.life]/7.2: the glvalue is used to call a non-static member function of the object

[basic.life]/6 lacks a description of using pointers to access the object, but the lvalue result of pointer dereferencing still applies to [basic.life]/7.1. [basic.life]/7 lacks a description of accessing a non-static data member of the object, but accessing a non-static data member of the object is accessing the object.

And wording that applies only to pointers in [basic.life]/6:

  • [basic.life]/6.1: the object will be or was of a class type with a non-trivial destructor and the pointer is used as the operand of a delete-expression
  • [basic.life]/6.4: the pointer is used as the operand of a static_­cast ([expr.static.cast]), except when the conversion is to pointer to cv void, or to pointer to cv void and subsequently to pointer to cv char, cv unsigned char, or cv std​::​byte ([cstddef.syn])

This creates unnecessary repetition and can be confusing. So, wording similar to cppreference#Access outside of lifetime can be used.

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

Compare [basic.life]/6 and [basic.life]/7, including the pointer-only cases listed in the issue, and read cppreference's “Access outside of lifetime” section for context. Done means the draft avoids duplicated wording while still covering pointer access, non-static data member access, member-function calls, delete-expressions, and the listed casts.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.