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
If a class member access operator, including an implicit “this->”, is used to access a non-static data member or non-static member function, the reference is ill-formed if the left operand (considered as a pointer in the “.” operator case) cannot be implicitly converted to a pointer to the naming class of the right operand.
structA{
int a = 0;
};
structB: A{
};
const B b;
(&b)->A::a;
The naming class of the right operand is class B while the left operand is a pointer to const B, from a pointer to const B to a pointer to A discards the cv-qualification, hence the implicit conversion cannot be done. It is not the intent of this rule, however, it is not clear in this wording about whether considering the cv-qualification when we say implicit conversions.
The text was updated successfully, but these errors were encountered:
[class.access.base] p6
The naming class of the right operand is class
B
while the left operand is a pointer to constB
, from a pointer to constB
to a pointer toA
discards the cv-qualification, hence the implicit conversion cannot be done. It is not the intent of this rule, however, it is not clear in this wording about whether considering the cv-qualification when we say implicit conversions.The text was updated successfully, but these errors were encountered: