You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The aforementioned paragraph contains this example
struct X { };
struct B { operator X(); };
B b;
X x({b}); // error: B::operator X() is not a candidate
I think that is supposed to demonstrate the last bullet, "the second
phase of [over.match.list] when the initializer list has exactly one
element ...". However there are at least two problems with the example
The move and copy constructor is not a candidate by [over.match.list] but by [over.match.ctor]
X is an aggregate, so the reason that B::operator X is not
considered is that it will never be evaluated as a potential
candidate. [over.match.ctor] consideres those constructors and [over.ics.list] then for both constructors end up with "In all cases
other than those enumerated above, no conversion is possible.".
This has nothing to do with the points of 16[over.best.ics]p4 though,
so the example appears to be irrelevant to me. In order to fix this, I
think the example should use {{b}}, and make X a non-aggregate
class, if the example was really supposed to demonstrate the last
bullet of 16[over.best.ics]p4.
Personally I also find it confusing that the comment says that B::operator X is not a candidate, even though it is the move/copy constructor of X that would immediately be affected by the rules, if I am not mistaken? But, I suspect that's more of a matter of taste.
The text was updated successfully, but these errors were encountered:
[over.best.ics]p4 says "under these conditions (long list), user-defined conversion sequences are not considered." So, it seems the conversion function is the one "not considered", not the copy/move constructor for X. I do agree with the brace-init and aggregate changes, though.
Copying the content of my std-discussion message:
The aforementioned paragraph contains this example
I think that is supposed to demonstrate the last bullet, "the second
phase of
[over.match.list]
when the initializer list has exactly oneelement ...". However there are at least two problems with the example
[over.match.list]
but by[over.match.ctor]
B::operator X
is notconsidered is that it will never be evaluated as a potential
candidate.
[over.match.ctor]
consideres those constructors and[over.ics.list]
then for both constructors end up with "In all casesother than those enumerated above, no conversion is possible.".
This has nothing to do with the points of
16[over.best.ics]p4
though,so the example appears to be irrelevant to me. In order to fix this, I
think the example should use
{{b}}
, and makeX
a non-aggregateclass, if the example was really supposed to demonstrate the last
bullet of
16[over.best.ics]p4
.Personally I also find it confusing that the comment says that
B::operator X
is not a candidate, even though it is the move/copy constructor ofX
that would immediately be affected by the rules, if I am not mistaken? But, I suspect that's more of a matter of taste.The text was updated successfully, but these errors were encountered: