title: Templatized derived class inheriting through CRTP class, access to base class member object
body: <p>If I try to call a member function of a member of the base class from a template class on the other end of the inheritance hierarchy,</p>
  
  <pre><code>class memberobj {public: void bar(){}};
  
  class basis {public: memberobj foo;};
  
  template&lt;class Base, class Derived&gt;
  class crtp : public Base { /* ... */ };
  
  template&lt;class Option&gt;
  class choice : crtp&lt; basis, choice&lt;Option&gt; &gt; {
    using basis::foo;
   public:
    void test () {foo.bar();}
  };
  
  class someoption {};
  
  int main() {
    choice&lt;someoption&gt; baz;
    baz.test();
    return 0;
  }
  </code></pre>
  
  <p>I get this error message:</p>
  
  <pre><code>g++-4.6 -o bin/crtptest crtptest.cpp
  crtptest.cpp: In member function ‘void choice&lt;Option&gt;::test()’:
  crtptest.cpp:12:21: error: ‘class basis’ has no member named ‘bar’
  make: *** [bin/crtptest] Error 1
  </code></pre>
  
  <p>though <code>bar</code> is obviously a member of <em>a member of</em> <code>basis</code>, not of <code>basis</code> itself.<br>This does not happen with non-template final classes (of which a number are already in use, all deriving through the <code>crtp</code> intermediate class; so I wouldn't want to change anything about that), nor with a template class that directly derives from <code>basis</code>.</p>
  
  <p>What's wrong here?</p>