Visual-C++ 11 (VS 2012): Copy constructor with defaulted second argument prevents copy elision - by Martin Ba. _

Status : 

 


2
0
Sign in
to vote
ID 805051 Comments
Status Active Workarounds
Type Bug Repros 1
Opened 10/10/2013 1:43:11 PM
Access Restriction Public

Description

When a type specifies a copy constructor with a defaulted argument, like:

LogMe(LogMe const&, int def=0) { }

the VC11 compiler does not elide the copy/move.

This can be observed for initialization as well as for RVO and NRVO. It affects both the copy- as well as the move-ctor.

I'm using: Microsoft Visual Studio Express 2012 for Windows Desktop / Version 11.0.51106.01 Update 1

See also: http://stackoverflow.com/questions/19282925/stdpair-move-not-elided-on-definition
Sign in to post a comment.
Posted by Niels Dekker on 4/4/2014 at 2:19 PM
I reproduced this bug on VS2013 (both Debug and Release mode).
Posted by Martin Ba. _ on 10/11/2013 at 12:34 AM
I have now also checked with the current VS2013 RC compiler, and it appears the bug is the same there.
Posted by Microsoft on 10/10/2013 at 8:02 PM
Thank you for submitting feedback on Visual Studio 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 Microsoft on 10/10/2013 at 1:51 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)