VC10: Results of by-value conversion operators are not treated as rvalue correctly - by Dávid Róbert

Status : 

  Duplicate<br /><br />
		This item appears to be a duplicate of another existing Connect or internal item.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 648825 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 3/2/2011 5:33:27 AM
Access Restriction Public


When an object has a conversion operator that converts to another type by-value, the result of the conversion operator is a temporary, so it should be an rvalue. VC10 compiler erroneously binds this temporary to lvalue reference, even when there is an rvalue binding available.

It seems like that the compiler decides whether I have an lvalue or rvalue based on the original type's r/lvalue-ness, and not based on the return type of conversion.

(See sample code for more.)
Sign in to post a comment.
Posted by Ulzii [MSFT] on 3/3/2011 at 4:01 PM
Hello David,

Thank you for reporting this issue. We're working on fixing this bug in our current in-progress release. You should see it fixed in the next major release of VS.

Ulzii Luvsanbat
Windows C++ Team
Posted by Microsoft on 3/2/2011 at 9:08 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 3/2/2011 at 6:13 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(