This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See for the official list.


1835. Dependent member lookup before <

Section: _N4868_.6.5.6  [basic.lookup.classref]     Status: CD6     Submitter: Richard Smith     Date: 2014-01-17

[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 ( [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.


   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.