title: Passing a lambda to a template function on VC10
body: <p>I wrote the following code on VC10. Calling f1 is okay, but on calling f2 the compiler showed an error. The difference between the two functions is only "template ", but the template type is actually not used. Why does the error occur?</p>
  
  <pre><code>#include &lt;functional&gt;
  
  void f1( std::tr1::function&lt;void()&gt; f)
  {
  }
  
  template &lt;typename &gt;
  void f2( std::tr1::function&lt;void()&gt; f)
  {
  }
  
  int main()
  {
      f1( []{} );
      f2( []{} ); // Error C2783
  }
  </code></pre>
  
  <hr>
  
  <p>Now I understand the error on the first code. How about the following code? Is it the error reason that the compiler can't decide the template type because lambda generates an internal anonymous class, but it is different from std::tr1::function?</p>
  
  <pre><code>#include &lt;functional&gt;
  
  class MyClass
  {
  };
  
  template &lt;typename T&gt;
  void f2( std::tr1::function&lt;void(T)&gt; f)
  {
  }
  
  int main()
  {
      std::tr1::function&lt;void(MyClass)&gt; f= [](MyClass v){};
  
      f2( f );
      f2( [](MyClass v){} ); // C2784
  }
  </code></pre>