This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 113d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-03-20


1771. Restricted lookup in nested-name-specifier

Section: 6.5.5  [basic.lookup.qual]     Status: CD6     Submitter: Canada     Date: 2013-09-24

[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]

N3690 comment CA 21

Consider the following example:

  template <typename T> struct B { };
  namespace N {
    namespace L {
      template <int> void A();
    }
    namespace M {
      template <int> struct A { typedef int y; };
    }
    using namespace L;
    using namespace M;
  }
  B<N::/*template */A<0>::y> (x);

Which A is referenced in the last line? According to 6.5.5 [basic.lookup.qual] paragraph 1,

If a :: scope resolution operator in a nested-name-specifier is not preceded by a decltype-specifier, lookup of the name preceding that :: considers only namespaces, types, and templates whose specializations are types.

It is not clear whether this applies to the example or not, and the interpretation of the < token depends on the result of the lookup.

Notes from the September, 2013 meeting:

The restricted lookup mentioned in 6.5.5 [basic.lookup.qual] paragraph 1 is based on a one-token lookahead; because the next token following A in the example is not ::, the restricted lookup does not apply, and the result is ambiguous. Uncommenting the template keyword in the example does not affect the lookup.