Title
Dependent-class lookup in the current instantiation
Status
dup
Section
13.8.3 [temp.dep]
Submitter
Johannes Schaub

Created on 2012-07-22.00:00:00 last changed 148 months ago

Messages

Date: 2012-09-15.00:00:00

Rationale (September, 2012):

This issue is a duplicate of issue 591.

Date: 2022-11-20.07:54:16

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.)

History
Date User Action Args
2012-09-24 00:00:00adminsetmessages: + msg4035
2012-07-22 00:00:00admincreate