title: "warning C4350: behavior change" when including <string> and no precompiled header
body: <p>Warning C4350 says "A non-const reference may only be bound to an lvalue".  I think since C4350 is off by default I haven't found much out there on it.  I have read this post and it makes sense: 
  <a href="https://stackoverflow.com/questions/6967927/non-const-reference-may-only-be-bound-to-an-lvalue">Non-const reference may only be bound to an lvalue</a></p>
  
  <p>Anyway, I'm asking about it because I'm trying to update VS2008 VC++ projects to VS2012.  When I do I get hundreds of C4350 warnings which I have turned on for some legacy reason (that admittedly may need to be reassessed).  I have whittled it down to this simple bit of code that can reproduce the warning, but only if I have precompiled headers turned off:</p>
  
  <pre><code>#pragma warning(default:4350)
  
  #include "stdafx.h"
  #include &lt;string&gt;
  
  int _tmain(int argc, char* argv[])
  {
     return 0;
  }
  </code></pre>
  
  <p>If I turn precomiled headers on I get no warning.  I also can't get it to happen in VS2008.</p>
  
  <p>Is this a Visual Studio 2012 bug in std:string?  Why does the precompiled header change the behavior?  How do I fix the problem, as opposed to just ignoring the warning?  Thanks!</p>
  
  <p>The warning is (sorry for the poor formatting, it was the best I could figure):</p>
  
  <p>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(689): warning C4350: behavior change: 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc(const std::_Wrap_alloc&lt;_Alloc> &amp;) throw()' called instead of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc>(_Other &amp;) throw()'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0(838) : see declaration of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0(850) : see declaration of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          A non-const reference may only be bound to an lvalue</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(688) : while compiling class template member function 'std::_Wrap_alloc&lt;_Alloc> std::_String_alloc&lt;_Al_has_storage,_Alloc_types>::_Getal(void) const'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator,</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(898) : see reference to function template instantiation 'std::_Wrap_alloc&lt;_Alloc> std::_String_alloc&lt;_Al_has_storage,_Alloc_types>::_Getal(void) const' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator,</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(700) : see reference to class template instantiation 'std::_String_alloc&lt;_Al_has_storage,_Alloc_types>' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\stdexcept(31) : see reference to class template instantiation 'std::basic_string&lt;_Elem,_Traits,_Alloc>' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Elem=char,</p>
  
  <p>1>              _Traits=std::char_traits,</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(689): warning C4350: behavior change: 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc(const std::_Wrap_alloc&lt;_Alloc> &amp;) throw()' called instead of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc>(_Other &amp;) throw()'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0(838) : see declaration of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0(850) : see declaration of 'std::_Wrap_alloc&lt;_Alloc>::_Wrap_alloc'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>
  
  <p>1>          A non-const reference may only be bound to an lvalue</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(688) : while compiling class template member function 'std::_Wrap_alloc&lt;_Alloc> std::_String_alloc&lt;_Al_has_storage,_Alloc_types>::_Getal(void) const'</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator,</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(898) : see reference to function template instantiation 'std::_Wrap_alloc&lt;_Alloc> std::_String_alloc&lt;_Al_has_storage,_Alloc_types>::_Getal(void) const' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Alloc=std::allocator,</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\xstring(700) : see reference to class template instantiation 'std::_String_alloc&lt;_Al_has_storage,_Alloc_types>' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Al_has_storage=false,</p>
  
  <p>1>              _Alloc_types=std::_String_base_types></p>
  
  <p>1>          ]</p>
  
  <p>1>          c:\program files (x86)\microsoft visual studio 11.0\vc\include\string(689) : see reference to class template instantiation 'std::basic_string&lt;_Elem,_Traits,_Alloc>' being compiled</p>
  
  <p>1>          with</p>
  
  <p>1>          [</p>
  
  <p>1>              _Elem=wchar_t,</p>
  
  <p>1>              _Traits=std::char_traits,</p>
  
  <p>1>              _Alloc=std::allocator</p>
  
  <p>1>          ]</p>