This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-11-11
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.)
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.