cplusplus / cplusplus/draft

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

Open
#5,511 0 comments 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

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

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

Start at [dcl.init.ref] paragraph 5.4.1 and compare its wording with the non-reference copy-initialization rules. Done means the text refers to the selected function call and correctly covers both conversion functions and constructors without changing the intended initialization semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.