Created on 2014-01-17.00:00:00 last changed 27 months ago
[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]
According to _N4868_.6.5.6 [basic.lookup.classref] paragraph 1,
In a class member access expression (7.6.1.5 [expr.ref]), if the . or -> token is immediately followed by an identifier followed by a <, the identifier must be looked up to determine whether the < is the beginning of a template argument list (13.3 [temp.names]) or a less-than operator. The identifier is first looked up in the class of the object expression. If the identifier is not found, it is then looked up in the context of the entire postfix-expression and shall name a class template.
Given
template<typename T> T end(T); template<typename T> bool Foo(T it) { return it->end < it->end; }
since it is dependent and thus end cannot be looked up in the class of the object expression, it is looked up in the context of the postfix-expression. This lookup finds the function template, making the expression ill-formed.
One possibility might be to limit the lookup to the class of the object expression when the object expression is dependent.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-08-19 07:54:33 | admin | set | status: drwp -> cd6 |
2021-02-24 00:00:00 | admin | set | status: accepted -> drwp |
2020-12-15 00:00:00 | admin | set | status: drafting -> accepted |
2014-03-03 00:00:00 | admin | set | status: open -> drafting |
2014-01-17 00:00:00 | admin | create |