Skip to content

Clarify that direct-initialized, copy-initialized from E #4582

Description

@xmh0511

Presumably, "direct-initialized from E" and "copy-initialized from E" should be distinguishable with direct-initialization and copy-initialization. The initialization might be considered as an expression, as per

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.

I mean that an initialization has been a recipe(comprises the function will be called, if any) whose evaluation will initialize the destination object. However, direct(copy)-initialized from E might be a bit different.

There are many such a usage in the standard, such as
expr.static.cast#4

Otherwise, the result object is direct-initialized from E

dcl.dcl#dcl.init.aggr-5

Otherwise, if the element is not a reference, the element is copy-initialized from an empty initializer list

So, what's the appearance of form here for copy-initialize or direct-initialize respectively? In other words, if we say that an entity t is direct-initialized from an expression E, what's the form?

T t(E); // #1
T t{E}; //#2

Does it refer to #1 or #2? Similarly, when we say that an entity t is copy-initialized from an expression E, what's the form?

T t = E; //#3
T t = {E};  //#4

It does not specify in the standard.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bigAn issue causing a large set of changes, scattered across most of the text.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions