Created on 2010-08-02.00:00:00 last changed 131 months ago
[Voted into the WP at the November, 2010 meeting.]
Proposed resolution (September, 2010):
Change 7.6.1.5 [expr.ref] paragraph 5 as follows:
If E2 is a non-static data member or a non-static member function, the program is ill-formed if the class of which E2 is directly a member is an ambiguous base (6.5.2 [class.member.lookup]) of the naming class (11.8.3 [class.access.base]) of E2. [Note: The program is also ill-formed if the naming class is an ambiguous base of the class type of the object expression; see 11.8.3 [class.access.base]. —end note]
According to 7.6.1.5 [expr.ref] paragraph 5,
If E2 is a non-static data member or a non-static member function, the program is ill-formed if the class of which E2 is directly a member is an ambiguous base (6.5.2 [class.member.lookup]) of the naming class (11.8.3 [class.access.base]) of E2.
This does not cover the following case:
struct A { int i; }; struct B: A { }; struct C: A, B { }; void f(C* p) { p->A::i; // Should be ambiguous }
Notes (August, 2010):
The example in the FCD National Body comment is incorrect: it is missing the A:: in the next-to-last line.
The ambiguity actually is covered in the Standard but in an unexpected location: 11.8.3 [class.access.base] paragraph 6:
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.
An explanatory note, including a cross-reference to 11.8.3 [class.access.base], should be added to 7.6.1.5 [expr.ref] paragraph 6.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: fdis -> c++11 |
2011-04-10 00:00:00 | admin | set | status: dr -> fdis |
2010-11-29 00:00:00 | admin | set | messages: + msg3153 |
2010-11-29 00:00:00 | admin | set | status: tentatively ready -> dr |
2010-10-18 00:00:00 | admin | set | messages: + msg2974 |
2010-10-18 00:00:00 | admin | set | status: drafting -> tentatively ready |
2010-08-02 00:00:00 | admin | create |