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

2024-11-11


1281. Virtual and dependent base classes

Section: 13.8.3.2  [temp.dep.type]     Status: NAD     Submitter: Johannes Schaub     Date: 2011-03-28

Consider the following example:

  struct A {
   virtual void f() { /* base */ }
  };

  struct B : virtual A {
   virtual void f() { /* derived */ }
  };

  template<typename T>
  struct C : virtual A, T {
   void g() {
    this->f();
   }
  };

  int main() {
   C<B> c;
   c.g();
  }

This is reasonable C++03 code that is invalidated by the resolution of issue 1043. In the presence of virtual non-dependent base classes and other dependent base classes, one cannot rely on something being found for real when doing the lookup in the instantiation context (therefore, one cannot know whether a "typename" is actually valid or not, without knowing all dependent base classes).

Rationale (August, 2011):

This example is not sufficient motivation to revisit the outcome of issue 1043. ((T*)this)->f() can be used to allow lookup in a dependent base.