title: Better C++ syntax for template base class typedefs and functions?
body: <p>I have code that compiles fine with VC9 (Microsoft Visual C++ 2008 SP1) but not with GCC 4.2 (on Mac, if that matters).  If I pile on enough qualifiers and keywords I can force it to work in GCC but this doesn't seem right.</p>
  
  <p>Here's a minimal code sample exhibiting my problems:</p>
  
  <pre><code>template&lt; typename N &gt;
  struct B {
      typedef N n_type;                     // can derived class access typedef?
      void foo() {}                         // can derived class access function?
  };
  
  template&lt; typename N &gt;
  struct D : public B&lt;N&gt; {
  
      typedef B&lt;N&gt; b_type;
      typedef typename b_type::n_type bn_type;
  
      void f1( n_type ) {}                  // ERROR: 'n_type' has not been
                                            // declared
  
      void f2( typename B&lt;N&gt;::n_type ) {}   // OK, verbose
  
      void f3( b_type::n_type ) {}          // ERROR: 'struct B&lt;N&gt;::n_type' is 
                                            // not a type
  
      void f4( typename b_type::n_type ) {} // OK, verbose
  
      void f5( bn_type ) {}                 // OK, verbose typedefs
  
      void f6() { foo(); }                  // ERROR: there are no arguments to
                                            // 'foo' that depend on a template
                                            // parameter, so a declaration of
                                            // 'foo' must be available
  
      void f7() { b_type::foo(); }          // OK, verbose
  
  };
  </code></pre>
  
  <p>Am I wrong to expect a template class derived from another template class to be able to use inherited typedefs and functions directly?  Is there a better way to do this than what I've come up with so far?</p>