Skip to content

[dcl.init.ref] p5.4.1 "the result of the call" is not an expression to which type check can be done #5511

Open
@xmh0511

Description

@xmh0511

[dcl.init.ref] p5.4.1 says

The result of the call to the conversion function, as described for the non-reference copy-initialization, is then used to direct-initialize the reference.

This rule in introduced by CWG1571. The intent is that check the cv-qualification between the referenced type of the reference that is being initialized and the return type of the function call. However, a function call is either a glvalue or prvalue, the result of which is either an entity(i.e. an object or a function) or a value, which is not what we expect for checking whether discarding the cv-qualification. Moreover, the initializer expression used to initialize a reference is first to be an expression.

Another issue is that "the call to the conversion function" sounds like the selected function can only be the conversion function; a constructor is not a conversion function.

So, in order to clarify such two issues, [dcl.init.ref] p5.4.1 might be changed to

The call to the selected function, as described for the non-reference copy-initialization, is then used to direct-initialize the reference.

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