Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[over.best.ics] Remove redundant sub-bullet CWG2829 #3871

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sdkrystian
Copy link
Contributor

@sdkrystian sdkrystian commented Mar 13, 2020

The wording in [over.best.ics] p4 sub 3 is not only incorrect, but also redundant:

However, if the target is [...] the first parameter of a constructor or [...] and the constructor or user-defined conversion function is a candidate by:
[over.match.ctor], when the argument is the temporary in the second step of a class copy-initialization, [...]
user-defined conversion sequences are not considered.

The "temporary" wording referred to here was removed by P0135 in [dcl.init]/17.6.3. Additionally, this wording is not even necessary. Consider the following:

struct S
{
  S(std::string);
};

S a = "abc"; // ill-formed

[dcl.init]/17.6.3 dictates that the candidate functions here are chosen by [over.match.copy], meaning that [over.best.ics] p4 sub 4 applies from the get-go, thus not allowing the implicit conversion sequence from const char[4] to std::string to be formed as a user defined conversion sequence would be required but is not permitted.

The direct-initialization that is performed as the second step in [dcl.init]/17.6.3 will always follow the rules of [dcl.init]/17.6.1 since it is a prvalue of the same type, meaning the constructor selected by [over.match.copy] is the only function that will be called.

@zygoloid zygoloid added the cwg Issue must be reviewed by CWG. label Mar 14, 2020
@zygoloid
Copy link
Member

This is too subtle to proceed with without CWG oversight.

@tkoeppe
Copy link
Contributor

tkoeppe commented Nov 12, 2023

CWG meeting consensus, Nov 11: This should become a CWG issue.

@tkoeppe tkoeppe added the not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. label Nov 12, 2023
@jensmaurer
Copy link
Member

CWG2829

@jensmaurer jensmaurer changed the title [over.best.ics] Remove redundant sub-bullet [over.best.ics] Remove redundant sub-bullet CWG2829 Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants