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.match.best] Define 'worst conversion sequence' #4810

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

Conversation

jensmaurer
Copy link
Member

Fixes #4809.

DO NOT MERGE; this is obviously insufficient and incorrect.

@xmh0511
Copy link
Contributor

xmh0511 commented Aug 13, 2021

Actually, the corner case for [over.ics.list] p5 is that

#include <initializer_list>
struct A{
    operator short(){
        return 0;
    }
};
struct B{
    operator bool(){
        return 0;
    }
};
void fun(std::initializer_list<int>){}  //#1
void fun(std::initializer_list<bool>){}  //#2
int main(){
    fun({A{},B{}});
}

The worst conversion sequence selected in the implicit conversion sequence set of #1 will directly impact the result of comparing it with the obvious worst conversion sequence (A::short) in the set of #2. Regardless of A::short or B::bool, they are all the implicit conversion sequence that comprises a user-defined conversion followed by an integral promotion. Which is not better or worse than the other. If we consider A::short is the worst conversion sequence in the set of #1, then #1 is selected as per [over.match.best#over.ics.rank-3.3]. Otherwise, the invocation will be ambiguous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[over.ics.list] define "worst conversion sequence" CWG2492
2 participants