Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmh0511 opened this issue Sep 26, 2021 · 1 comment

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Sep 26, 2021

[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.

@xmh0511 xmh0511 changed the title [intro.execution] p5 Which constructs does a full-expression include/comprise/contain [intro.execution] p5 Which language constructs does a full-expression include/comprise/contain Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant