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
 
Back
Top