Compile error when explicitly instantiating shared_ptr - by jmcmod

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.


1
0
Sign in
to vote
ID 649531 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 3/4/2011 5:01:54 PM
Access Restriction Public

Description

Unable to use explicit instantiation on shared_ptr since upgrading to Visual Studio 2010.

I believe the problem exists in the routine below because _Mybase (which is _Ptr_base) does not have a swap method. It, instead, has a _Swap method.

	void swap(_Myt&& _Right)
		{	// exchange contents with movable _Right
		_Mybase::swap(_STD move(_Right));
		}

I removed the explicit instantiation and it resolved my problem. 

Note that the problem can also manifest via the following (granted it would be a strange thing to do):
   std::tr1::shared_ptr<int> a;
   a.swap(std::tr1::shared_ptr<int>(new int(1)));
Sign in to post a comment.
Posted by Microsoft on 3/7/2011 at 7:47 PM
Hi,

Thanks for reporting this bug. We've already fixed it, and the fix will be available in VC11. According to the latest C++0x Working Paper, shared_ptr isn't supposed to have an rvalue swap, much less a broken one. We've removed it, allowing shared_ptr to be explicitly instantiated again.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Microsoft on 3/6/2011 at 6:21 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/4/2011 at 5:14 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)