title: GCC-Visual Studio std::thread compiler differences
body: <p>EDIT: added the compiler errors at the end.
  First I'll say I have both Visual Studio Express 2013 and CodeBlocks (Mingw w64) set up and running.
  But I am having a problem with some code compiling with one compiler but not the other and vis-versa.</p>
  
  <p>Consider this code:</p>
  
  <pre><code>void foo(std::string&amp; s){
      std::cout &lt;&lt; "in foo function now" &lt;&lt; std::endl;
      s = "the new string.";
  }
  
  int main(){
      std::string s = "the original string";
      std::thread t1(foo, std::ref(s));
      t1.join();
  
      if (!s.size()) std::cout &lt;&lt; "s is empty" &lt;&lt; std::endl;
      else std::cout &lt;&lt; s &lt;&lt; std::endl;
  
      std::cin.get();
      return 0;
  }
  </code></pre>
  
  <p>It compiles and runs fine on both GCC and VS.</p>
  
  <p>BUT if I decide to change <code>std::ref(s)</code> with <code>std::move(s)</code> it won't compile with GCC anymore but it will with VS.
  To fix it I have to add a '&amp;' so <code>void foo(std::string&amp; s)</code> becomes <code>void foo(std::string&amp;&amp; s)</code>, THEN it will compile with gcc but it won't with VS anymore!</p>
  
  <p>My guess would be that the VS compiler is quiet forgiving and is not following the standard to the letter but I haven't withness such a behavior with std::function and std::bind even though the arguments are passed the same way I believe.</p>
  
  <p>At any rate I would very much appreciate some help in understanding what is going on.</p>
  
  <p>EDIT: The errors:
  The GCC one:</p>
  
  <pre><code>C:/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/include/c++/functional:1505:61: error: no type named 'type' in 'class std::result_of&lt;void (*(std::__cxx11::basic_string&lt;char&gt;))(std::__cxx11::basic_string&lt;char&gt;&amp;)&gt;'
         typedef typename result_of&lt;_Callable(_Args...)&gt;::type result_type;
                                                               ^
  C:/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/include/c++/functional:1526:9: error: no type named 'type' in 'class std::result_of&lt;void (*(std::__cxx11::basic_string&lt;char&gt;))(std::__cxx11::basic_string&lt;char&gt;&amp;)&gt;'
           _M_invoke(_Index_tuple&lt;_Indices...&gt;)
  </code></pre>
  
  <p>The VS one:</p>
  
  <pre><code>Error   1   error C2664: 'void (std::string &amp;&amp;)' : cannot convert argument 1 from 'std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt;&gt;' to 'std::string &amp;&amp;' c:\program files (x86)\microsoft visual studio 12.0\vc\include\functional   1149    1   Tests
  </code></pre>