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

2024-12-19


1526. Dependent-class lookup in the current instantiation

Section: 13.8.3  [temp.dep]     Status: dup     Submitter: Johannes Schaub     Date: 2012-07-22

According to 13.8.3 [temp.dep] paragraph 3,

In the definition of a class or class template, if a base class depends on a template-parameter, the base class scope is not examined during unqualified name lookup either at the point of definition of the class template or member or during an instantiation of the class template or member.

Note that this is phrased not as “if a base class is a dependent type” but as “if a base class depends on a template-parameter;” the current instantiation depends on a template-parameter but is not a dependent type. The difference can be seen in this example:

  template<typename T> struct A {
    typedef int type;
    struct C;
  };

  template<typename T> struct A<T>::C {
    void type();
    struct B;
  };

  template<typename T> struct A<T>::C::B : A<T> {
    type x;
  };

  A<int>::C::B b;   // #1

If the excluded bases were dependent types, the reference to type at #1 would resolve to A::type; with the current wording, the reference resolves to C::type.

(See also issue 1524 for another case in which this distinction makes a difference.)

Rationale (September, 2012):

This issue is a duplicate of issue 591.