title: Error when using stream insertion on parameter of type wstringstream in GCC but not MSVC
body: <p>I have a header that I've put together to assist with logging in an application using MSVC v141 (Visual Studio 2017). Since these logging utilities are useful, I wanted to bring it into a project I've just started that is using CMake and MinGW/GCC. The header itself should be standalone, it just performs some magic to abstract away common info and stream destinations so that all I have to do is call InitLogging() in my main loop then make calls to LogInfo/LogError/etc, but when I compile against <code>MinGW(10.3.0 [MSYS2])/GCC(7.5.0 [Ubuntu])</code>, I am given the following error:</p>
  <pre class="lang-c prettyprint-override"><code>error: invalid initialization of reference of type ‘const wstringstream&amp; {aka const std::__cxx11::basic_stringstream&lt;wchar_t&gt;&amp;}’ from expression of type ‘std::basic_ostream&lt;wchar_t&gt;’
   #define LogInfo(str) { LogMessage(eLogLevel_INFO, std::wstringstream() &lt;&lt; LOG_HELPER &lt;&lt; str, std::wstringstream() &lt;&lt; LOG_HELPER_2);  }
  /mnt/d/dev/test_logger/src/main.cpp:9:2: note: in expansion of macro ‘LogInfo’
    LogInfo(L&quot;Test log&quot;);
  </code></pre>
  <p>Here is the relevant code from the header:</p>
  <pre class="lang-cpp prettyprint-override"><code>std::wstring Time2String();
  
  #define LOG_HELPER __FUNCTION__ &lt;&lt; L&quot;(): &quot;
  #define LOG_HELPER_2 L&quot;[&quot; &lt;&lt; Time2String() &lt;&lt; &quot;] &quot;
  
  inline void LogMessage(eLogLevel lvl, const std::wstringstream&amp; str, const std::wstringstream&amp; logHelper);//Snipped definition
  
  #define LogInfo(str) { LogMessage(eLogLevel_INFO, std::wstringstream() &lt;&lt; LOG_HELPER &lt;&lt; str, std::wstringstream() &lt;&lt; LOG_HELPER_2);  }
  </code></pre>
  <p>If I simply pass the <code>std::wstreamstring()</code>s without any insertions or if I instantiate variables of that type outside of the call and perform the insertions on those variables outside the call, then the compiler is happy, though it is equally unhappy if I try to perform insertions on the variables from the function call similar to the current <code>#define</code>.</p>
  <p>examples:</p>
  <pre class="lang-cpp prettyprint-override"><code>LogInfo(L&quot;Test log&quot;);//compile error
  
  /*******************************************/
  std::wstringstream tmpSStream, tmpSStream2;
  tmpSStream &lt;&lt; LOG_HELPER &lt;&lt; L&quot;Test log&quot;;
  tmpSStream2 &lt;&lt; LOG_HELPER_2;
  LogMessage(eLogLevel_INFO, tmpSStream, tmpSStream2);//no error
  
  /*******************************************/
  LogMessage(eLogLevel_INFO, std::wstringstream(), std::wstringstream());//no error
  
  /*******************************************/
  std::wstringstream tmpSStream, tmpSStream2;
  LogMessage(eLogLevel_INFO, tmpSStream &lt;&lt; LOG_HELPER &lt;&lt; L&quot;Test log&quot;, tmpSStream2 &lt;&lt; LOG_HELPER_2);//compile error
  </code></pre>
  <p>Is this a bug in GCC or is MSVC doing something it shouldn't be?</p>