Constructor with reference arguments in g++ compiler
<p>Have a look at the following piece of code</p>

<p>Header File:</p>

<pre><code>class CxUser
{ 
public:
    CxUser(string&amp; guid) {} 
};
</code></pre>

<p>I have a c++ file that instantiates the class using <code>CxUser(string("xxx-xxx-x-xxxx"))</code>. But this statement fails to compile in g++ with error "<strong><em>no matching function for call to CxUser::CxUser(std::string)</em></strong>" whereas it compiles in VC++. Surprisingly, the following piece of code to instantiate the class works.</p>

<pre><code>string guid("xxx-x-xxxx-xxx-xx"); CxUser user(guid);
</code></pre>

<p>Any help would be appreciated....</p>
