title: expected primary-expression before ">" in g++ but not in microsoft compiler
body: <p>This code fails to compile on g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3, with this error</p>
  
  <pre><code>test.cpp: In function ‘T mul(V&amp;, V&amp;)’:
  test.cpp:38:27: error: expected primary-expression before ‘&gt;’ token
  test.cpp:38:29: error: expected primary-expression before ‘)’ token
  test.cpp:38:53: error: expected primary-expression before ‘&gt;’ token
  test.cpp:38:55: error: expected primary-expression before ‘)’ token
  </code></pre>
  
  <p>but it compiles and executes correctly on Microsoft C/C++ Optimizing Compiler Version 15.00.21022.08 for x64</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;complex&gt;
  
  template &lt;class T&gt;
  class SM
  {
  public:
      T value;
  };
  
  template &lt;class T&gt;
  class SC : public SM&lt;T&gt;
  {
  };
  
  class PSSM {
  
  public:
      template &lt;class T&gt;
      T &amp; getSC() { return sc; }
  
  private:
      SC&lt;double&gt; sc;
  };
  
  class USSM {
  
  public:
      template &lt;class T&gt;
      T &amp; getSC() { return sc; }
  
  private:
      SC&lt;std::complex&lt;double&gt; &gt; sc;
  };
  
  template &lt;class T, class V&gt;
  T mul( V &amp; G, V &amp; S) {
      return (G.getSC&lt;SC&lt;T&gt; &gt;().value * S.getSC&lt;SC&lt;T&gt; &gt;().value); // error is here
  }
  
  
  int main() {
      PSSM p;
      PSSM q;
      p.getSC&lt;SC&lt;double&gt; &gt;().value = 5; 
      q.getSC&lt;SC&lt;double&gt; &gt;().value = 3; 
  
      std::cout &lt;&lt; mul&lt;double&gt;(p,q);
  
  }
  </code></pre>
  
  <p>I don't understand where the problem is. Can anyone understand how to work around it, or explain the nature of the problem in g++?</p>