title: Visual C++ 10.0 bug in std::reference_wrapper?
body: <p>Code:</p>
  
  <pre><code>#include &lt;functional&gt;
  
  struct Foo
  {
      virtual void mf() = 0;
  };
  
  struct Bar: Foo
  {
      virtual void mf() {}
  };
  
  int main()
  {
      Bar o;
      std::reference_wrapper&lt;Foo const&gt; wrapper( o );
  }
  </code></pre>
  
  <p>Result with MinGW g++ 4.6.1:</p>
  
  <blockquote><pre>
  [d:\dev\test]
  > <i><b>g++ foo.cpp -std=c++0x</b></i>
  
  [d:\dev\test]
  > _
  </pre></blockquote>
  
  <p>Result with Visual C++ 10.0:</p>
  
  <blockquote><pre>
  [d:\dev\test]
  > <i><b>cl foo.cpp</b></i>
  foo.cpp
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xrefwrap(371) : see reference to class template instantiation 'std::tr1::_Call_wrapper' being compiled
          with
          [
              _Callable=std::tr1::_Callable_obj
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xrefwrap(416) : see reference to class template instantiation 'std::tr1::_Refwrap_impl' being compiled
          with
          [
              _Ty=const Foo
          ]
          foo.cpp(16) : see reference to class template instantiation 'std::tr1::reference_wrapper' being compiled
          with
          [
              _Ty=const Foo
          ]
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2027: use of undefined type 'std::
  tr1::_Result_of'
          with
          [
              _Ty=const Foo (void)
          ]
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(9) : error C2143: syntax error : missing ';' before '('
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(10) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxcallwrap(8) : error C2259: 'Foo' : cannot instantiate abstract class
          due to following members:
          'void Foo::mf(void)' : is abstract
          foo.cpp(5) : see declaration of 'Foo::mf'
  
  [d:\dev\test]
  > _
  </pre></blockquote>
  
  <p>I like the way that the Visual C++ compiler tells the user 11 times that the abstract class cannot be instantiated, just to hammer the point home, like, in case the user was not aware of that. But should <code>std::reference_wrapper</code> really instantiate the class? Is not much of the point of (passing by) reference to <em>not</em> require instantiation?</p>
  
  <p>I.e., is this, as I strongly suspect, a bug in the Visual C++ standard library implementation?</p>