title: Typedef-type inside template class gives compile error
body: <p>Real code, stripped to simplest relevant parts:</p>
  
  <h2>3rd-party code</h2>
  
  <pre><code>template&lt;class T&gt;
  class Ptr
  {
  private:
  
      typedef Ptr this_type;
  
  public:
  
      typedef T element_type;
  };
  </code></pre>
  
  <hr>
  
  <pre><code>typedef Ptr&lt;DataSet&gt; DataSetPtr;
  </code></pre>
  
  <hr>
  
  <h2>My Code - GPtr.h</h2>
  
  <pre><code>template&lt;class BaseType&gt;
  class GPtr
  {
      ///force BaseType to be a Ptr or subclass
      typedef BaseType::element_type WrappedType;
  public:
      ...
  };
  </code></pre>
  
  <p>If I remove the reference to <code>BaseType::element_type</code> it compiles fine, but with it in I get compile warnings/errors:</p>
  
  <ul>
  <li>warning C4346: 'BaseType::element_type' : dependent name is not a type prefix with 'typename' to indicate a type</li>
  <li>error C2146: syntax error : missing ';' before identifier 'WrappedType'</li>
  </ul>
  
  <p>I am not even <em>using</em> <code>GPtr</code> anywhere in my code as a specific templated type... simply including gptr.h leads to the problem.</p>
  
  <p>What is wrong here?</p>