Title
Virtual and dependent base classes
Status
nad
Section
13.8.3.2 [temp.dep.type]
Submitter
Johannes Schaub

Created on 2011-03-28.00:00:00 last changed 149 months ago

Messages

Date: 2011-08-15.00:00:00

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.

Date: 2022-11-20.07:54:16

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

History
Date User Action Args
2012-09-24 00:00:00adminsetmessages: + msg4027
2011-03-28 00:00:00admincreate