title: Why is template function of data member a dependent name only when qualifying with "this"?
body: <pre><code>struct Bar {
      template&lt;typename&gt;
      void baz() {
      }
  };
  
  template&lt;typename&gt;
  struct Foo {
      Bar bar;
  
      Foo() {
          bar.baz&lt;int&gt;();
      }
  };
  
  int main() {
      return 0;
  }
  </code></pre>
  
  <p>This code compiles fine (in GCC 4.7), but if I prefix the call to <code>bar.baz&lt;int&gt;()</code> with <code>this-&gt;</code>, <code>baz</code> becomes a dependent name that needs disambiguating with <code>template</code>.</p>
  
  <pre><code>bar.baz&lt;int&gt;(); // OK
  this-&gt;bar.baz&lt;int&gt;(); // error
  this-&gt;bar.template baz&lt;int&gt;(); // OK
  </code></pre>
  
  <p>Surely <code>this-&gt;bar</code> can only refer to <code>Bar bar</code>, whose member <code>baz</code> is clearly a template?  Why does the addition of <code>this-&gt;</code> make this code ambiguous to the compiler?</p>
  
  <p>p.s. Originally, <code>bar</code> was a data member of a base class template which needed disambiguating with <code>this-&gt;</code>, but I have simplified the example for the purpose of this question.</p>