cplusplus / cplusplus/draft

[intro.execution] p5 Which language constructs does a full-expression include/comprise/contain

Open
#4,940 1 comment 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

[intro.execution] p5

A full-expression is

  • [...]

If a language construct is defined to produce an implicit call of a function, a use of the language construct is considered to be an expression for the purposes of this definition. Conversions applied to the result of an expression in order to satisfy the requirements of the language construct in which the expression appears are also considered to be part of the full-expression. For an initializer, performing the initialization of the entity (including evaluating default member initializers of an aggregate) is also considered part of the full-expression.

struct S {
  S(int i): I(i) { }            // full-expression is initialization of I
  int& v() { return I; }
  ~S() noexcept(false) { }
private:
  int I;
};
S s1(1);                        // full-expression comprises call of S​::​S(int)

According to the emphasized wording, the initialization of s1 can produce an implicit call of S::S(int), hence the initialization is considered to be an expression. We explicitly say the initialization would be part of the full-expression, however, we didn't explicitly say the implicit call is also considered to be part of that full-expression. Moreover, the case mentioned in [intro.execution] p6, it intends to say these default arguments are part of the full-expression, however, it is just a note, there is no normative rule that says that.

Should we say the subexpressions of an expression that is a part of a full-expression are also part of that full-expression? That would make the comment "full-expression comprises call of S​::​S(int)" as well as [intro.execution] p6 have a formal interpretation.

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 [intro.execution] paragraphs 5 and 6, including the full-expression definition and its examples. Determine whether the normative wording covers implicit calls, initializer evaluation, default arguments, and subexpressions; done means the standard text and notes have an unambiguous formal interpretation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.