cplusplus / cplusplus/draft

[dcl.init.ref] Constructors not mentioned when user-defined conversions are used

Open
#3,217 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cwg
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

[dcl.init.ref] subclause 5.4.1 says:

If T1 or T2 is a class type and T1 is not reference-related to T2, user-defined conversions are considered using the rules for copy-initialization of an object of type “cv1 T1” by user-defined conversion; the program is ill-formed if the corresponding non-reference copy-initialization would be ill-formed. 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. For this direct-initialization, user-defined conversions are not considered.

It states that used-defined conversions are considered (using the rules for copy-initialization of an object), however, it only specifies what will happen when a conversion function is chosen, and there is no mention of what would happen if a constructor is chosen.

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 with [dcl.init.ref] subclause 5.4.1 and compare its description of user-defined conversions with the referenced copy-initialization rules. Determine how the wording should address the case where a constructor is chosen, then verify that the clause clearly specifies the resulting reference initialization behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.