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
structA{
A() = default;
A(volatileconst A&){}
voidshow()const volatile {} // its implicit object parameter is of type volatile const A&
};
volatile A a;
A b = std::move(a); //1 ill-formedstd::move(a).show(); //2 ok
Since prescribed in [dcl.init.ref#5.2]
Otherwise, if the reference is an lvalue reference to a type that is not const-qualified or is volatile-qualified, the program is ill-formed.
"//1" is definitely ill-formed. However, according to [over.match.funcs#general-4], the implicit object parameter should be volatile const A&, the parameter type is basically the same as that of "//1" chosen. Presumably,[over.match.funcs#general-5] gives the privilege, that is
For non-static member functions declared without a ref-qualifier, even if the implicit object parameter is not const-qualified, an rvalue can be bound to the parameter as long as in all other respects the argument can be converted to the type of the implicit object parameter.
Since there is not an exception expound in [dcl.init.ref#5.2], it appears to me that the conflict would be resulted in by [over.best.ics#general-1], that is
The sequence of conversions is an implicit conversion as defined in [conv], which means it is governed by the rules for initialization of an object or reference by a single expression ([dcl.init], [dcl.init.ref]).
My proposal is that we should first change [dcl.init.ref#5.2] to that
Otherwise, if the reference is an lvalue reference to a type that is not const-qualified or is volatile-qualified, unless somewhere specified, the program is ill-formed.
Back to [over.match.funcs#general-5], I think that the expound "in all other respects" is unclear, I think it should be modified as the following so that will be more clear
For non-static member functions declared without a ref-qualifier, even if the implicit object parameter is not const-qualified or is volatile-qualified, or both, an rvalue can be bound to the parameter as long as their referenced types are reference-compatible.
In terms of the original [over.match.funcs#general-5], for instance
structTest{
voidshow(){}
};
Test const t;
std::move(t).show(); // ill-formed
It is not fine for explaining this example.
The text was updated successfully, but these errors were encountered:
How do you read it "as long as in all other respects the argument can be converted to the type of the implicit object parameter"? For this special case, we just skip [dcl.init.ref#5.2] and go into these next bullets, Is that your interpretation? If it were said, "even if the implicit object parameter is not const-qualified" is not sufficient, we should also mention "is volatile-qualified" to make the whole [dcl.init.ref#5.2] be skipped in this special case.
In addition, "the implicit object parameter is not const-qualified" sounds a bit strange, the type of the implicit object parameter is a reference, a reference cannot be cv-qualified. Should we say that
the reference type of the implicit object parameter is not const-qualified or is volatile-qualified
Since prescribed in [dcl.init.ref#5.2]
"//1" is definitely ill-formed. However, according to [over.match.funcs#general-4], the implicit object parameter should be
volatile const A&
, the parameter type is basically the same as that of "//1" chosen. Presumably,[over.match.funcs#general-5] gives the privilege, that isSince there is not an exception expound in [dcl.init.ref#5.2], it appears to me that the conflict would be resulted in by [over.best.ics#general-1], that is
My proposal is that we should first change [dcl.init.ref#5.2] to that
Back to [over.match.funcs#general-5], I think that the expound "in all other respects" is unclear, I think it should be modified as the following so that will be more clear
In terms of the original [over.match.funcs#general-5], for instance
It is not fine for explaining this example.
The text was updated successfully, but these errors were encountered: