Defect passing const lvalues by-value

  • Thread starter Thread starter Stefan Slapeta
  • Start date Start date
S

Stefan Slapeta

Hi,

please could anybody check if this defect is fixed in whidbey?

struct X
{
X() {}

X(X& x) {}

template <typename T>
X(T& x)
{
}
};

void sink(X) {}

int main()
{
X const const_x;
X a(const_x); // works!

sink(const_x); // doesn't compile!
}

// ------------------

error C2664: 'sink' : cannot convert parameter 1 from 'const X' to 'X'
No copy constructor available for struct 'X' or constructor attempts to
perform illegal conversion to non-__gc reference

// ------------------

Thanks,

Stefan
 
please could anybody check if this defect is fixed in whidbey?

Stefan,

It still gives the same error.

Dave
 
Is it possible to report this to Microsoft?

Consider it done already ;)

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top