Skip to content

[conv.general] Implicit conversion yielding prvalue should not produce a "temporary variable" #142

@t3nsor

Description

@t3nsor

Full name of submitter (unless configured in github; will be published with the issue): Brian Bi

Reference (section label): [conv.general]

Link to reflector thread (if any):

Issue description:
[conv.general]/6 states that "The effect of any implicit conversion is the same as performing the corresponding declaration and initialization and then using the temporary variable as the result of the conversion. The result is [...] a prvalue [if T is not a reference type] [...]"

This is self-contradictory. If the result of the implicit conversion is a prvalue, then the implicit conversion itself should not be creating a new object, which "the corresponding declaration and initialization" would do; the creation of a new object should occur at some later point in time when the prvalue is materialized or used for an actual initialization.

Suggested resolution:
Strike the word "temporary" from [conv.general]/3.

Edit [conv.general]/6 to read: "If T is a reference type, the effect of an implicit conversion is the same as performing the corresponding declaration and initialization and then using the temporary variable as the result of the conversion; the result is an lvalue if T is an lvalue reference type or an rvalue reference to function type ([dcl.ref]), and an xvalue otherwise. If T is not a reference type, the result is a prvalue that initializes its result object in the same manner by which the corresponding declaration and initialization initializes the variable t."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions