Open
Description
[class.access.base] p6
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.
struct A{
int a = 0;
};
struct B: 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.
Metadata
Metadata
Assignees
Labels
No labels