title: Is this a bug in Visual C++ 2010, or am I missing something?
body: <p>Given the following code:</p>
  
  <pre><code>#include &lt;vector&gt;
  
  template&lt;class C1, class C2, class Op&gt; 
  std::vector&lt;typename Op::result_type&gt; 
  f(Op op, const C1&amp; src1, const C2&amp; src2)
  {
  }
  
  template&lt;class It, class Op&gt; 
  std::vector&lt;typename Op::result_type&gt; g(Op op, It begin, It end)
  {
  }
  
  template&lt;class It1, class It2, class Op&gt;
  std::vector&lt;typename Op::result_type&gt; g(Op op, It1 left_begin, It1 left_end, It2 right_begin)
  {
      return std::vector&lt;typename Op::result_type&gt;();
  }
  
  struct ToS
  {
      typedef double result_type;
      double operator() (long , double ) const { return 0.0; }
  };
  
  std::vector&lt;double&gt; h(std::vector&lt;long&gt; const&amp; vl, std::vector&lt;double&gt; const&amp; vd)
  {
      return g(ToS(), vl.begin(), vl.end(), vd.begin());
  }
  </code></pre>
  
  <p>When compiled with Visual C++ 2010 (SP1), I get the following errors:</p>
  
  <pre><code>1&gt;VC10Error.cpp(30): error C2893: Failed to specialize function template 'std::vector&lt;Op::result_type&gt; g(Op,It1,It1,It2)'
  1&gt;          With the following template arguments:
  1&gt;          'std::_Vector_const_iterator&lt;_Myvec&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              _Myvec=std::_Vector_val&lt;long,std::allocator&lt;long&gt;&gt;
  1&gt;          ]
  1&gt;          'std::_Vector_const_iterator&lt;_Myvec&gt;'
  1&gt;          with
  1&gt;          [
  1&gt;              _Myvec=std::_Vector_val&lt;double,std::allocator&lt;double&gt;&gt;
  1&gt;          ]
  1&gt;          'ToS'
  1&gt;VC10Error.cpp(30): error C2780: 'std::vector&lt;Op::result_type&gt; g(Op,It,It)' : expects 3 arguments - 4 provided
  1&gt;          VC10Error.cpp(12) : see declaration of 'g'
  </code></pre>
  
  <p>I don't understand them.  First, of course, the error message basically
  sums up as "There's something wrong here, but we won't tell you what'.
  And secondly, I don't find anything wrong; nor does g++ (version 4.4.2).
  Other interesting symptoms: if you add a <code>using std::vector;</code> after the
  include, and delete all of the <code>std::</code>, it works&mdash;I would have
  thought that that should have no effect.  And if you delete either the
  function <code>f</code> (which really isn't used anywhere) or the first version of
  function <code>g</code>, it also works.</p>
  
  <p>So am I crazy, or is VC10 really not yet production-ready?</p>
  
  <p>EDITED: Just to add: if it is a bug in the compiler, how do I reliably work around it?</p>