title: Calling a base class method in a template virtual class hierarchy
body: <p>Let's say I have the following class hierarchy:</p>
  
  <pre><code>template&lt; class T &gt;
  class TestBase {
  
  public:
  
      virtual T const &amp; do_foo() = 0;
  
  };
  
  template&lt; class T &gt;
  class TestDerived : public virtual TestBase&lt; T &gt; {
  
  public:
  
      virtual int do_bar() {
          return do_foo() + 1;
      }
  
  };
  </code></pre>
  
  <p>GCC spits out the following:</p>
  
  <pre><code>error: there are no arguments to ‘do_foo’ that depend on a template parameter, so a declaration of ‘do_foo’ must be available [-fpermissive]
  note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
  </code></pre>
  
  <p>Now, if I change this to derive from a TestBase instantiated from a known type (e.g. <code>class TestDerived : public virtual TestBase&lt; int &gt;</code>, this snippet compiles just fine so the problem apparently has to do with the base class type being unknown at compile time. But since I haven't instantiated objects of either class anywhere, I don't see why this should even matter.</p>
  
  <p>Basically, how would I resolve the error without resorting to <code>-fpermissive</code>?</p>