Created on 2023-02-11.00:00:00 last changed 20 months ago
Suggested resolution:
Change 11.8.3 [class.access.base] paragraph 6 to actually perform the conversion it requires, possibly moving it to 7.6.1.5 [expr.ref] since it is not about access control; the definition of "naming class" in 11.8.3 [class.access.base] paragraph 5 would then need to be italicized.
Consider:
struct A {int i;}; struct X : A {}; struct Y : A {}; struct S : X,Y {}; void f(S &s) {++s.X::i;}
There is a rule that &s be able to "be implicitly converted to a pointer to the naming class of the right operand" (11.8.3 [class.access.base] paragraph 6), which correctly selects X here, but 7.6.1.5 [expr.ref] bullet 6.2 merely says that
If E2 is a non-static data member [...], the expression designates the corresponding member subobject of the object designated by the first expression.
E2 (i.e. X::i) and Y::i equally denote A::i (since name lookup produces declarations), but there is no rule that indicates which A::i is selected as the "corresponding member subobject". (Note that s.X::A::i means the same as s.A::i and is ambiguous.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-03-11 18:07:02 | admin | set | messages: + msg7224 |
2023-02-11 00:00:00 | admin | create |