Incorrectly duplicating object when it is a native one(NDT) in vs2010sp1(C++) - by UnitUniverse

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<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 679623 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 7/16/2011 2:36:15 PM
Access Restriction Public


  Recently i wrote a C++ TEMPLATE Library that should pass the type info transparently from the referenced sources to the target. Then I found the rvalue-referenced object being copied from the source(incorrectly maybe) rather than referencing to the original one like doing to const lvalue references.
  The 'error' is exactly like this:
If a source is a UDT object from struct/union/class, there is no such error at all;
If a source is a NDT object like int/char/float, etc, thers is such limitation there.
I don't think the micro-code optimization to CPU is an excuse for this error(sorry about the word, i just attempt to say that is logically-possible reason for) while to rvalue references or constant lvalue references.
The sample code shows what i told, Assuming those were the instantiated templates.

Sign in to post a comment.
Posted by UnitUniverse on 3/7/2012 at 7:45 PM
Hard to explain by several words...
I have figured out a way to solve this, working on both 2010(sp1) and v11.

I made a source file to describe what i said, which has been uploaded as the 'Attach a file'.

Posted by Microsoft on 11/23/2011 at 11:47 AM
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by UnitUniverse on 7/20/2011 at 1:23 PM
Any idea?
Posted by MS-Moderator08 [Feedback Moderator] on 7/17/2011 at 8:18 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 investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 7/16/2011 at 2:48 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(