Created on 2009-11-19.00:00:00 last changed 165 months ago
Rationale (March, 2011):
The analysis is incorrect; whether the reference is dependent or not, overload resolution chooses A::f(int) because of the rules in 12.2.2.2.2 [over.call.func] paragraph 3 dealing with contrived objects for static member functions.
Notes from the November, 2010 meeting:
The CWG agreed that the resolution of issue 515 was ill-advised and should be reversed.It's not clear how lookup of a non-dependent qualified name should be handled in a non-static member function of a class template. For example,
struct A { int f(int); static int f(double); }; struct B {}; template<typename T> struct C : T { void g() { A::f(0); } };
The call to A::f inside C::g() appears non-dependent, so one might expect that it would be bound at template definition time to A::f(double). However, the resolution for issue 515 changed 11.4.3 [class.mfct.non.static] paragraph 3 to transform an id-expression to a member access expression using (*this). if lookup resolves the name to a non-static member of any class, making the reference dependent. The result is that if C is instantiated with A, A::f(int) is called; if C is instantiated with B, the call is ill-formed (the call is transformed to (*this).A::f(0), and there is no A subobject in C<B>). Both these results seem unintuitive.
(See also issue 1017.)
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-04-10 00:00:00 | admin | set | messages: + msg3415 |
2011-04-10 00:00:00 | admin | set | status: drafting -> nad |
2010-11-29 00:00:00 | admin | set | messages: + msg3121 |
2010-11-29 00:00:00 | admin | set | status: open -> drafting |
2009-11-19 00:00:00 | admin | create |