[Codename Milan] Delegating constructors not working with explicit constructors - by Rutix

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.


2
0
Sign in
to vote
ID 770526 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 11/8/2012 1:50:57 PM
Access Restriction Public

Description

The code:

struct X {
    explicit X(int n) : value(n) {}
 
    // error C2664: 'X::X(const X &)' : cannot convert parameter 2 from 'int' to 'const X &'
    // works without the explicit keyword in X(int) constructor
    X() : X(0) {}
 
    int value;
};
 
int main()
{
    X x;
}

This is not correct. It should compile fine and compiles in gcc-4.5.1 and other compilers supporting C++11.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:31 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 11/21/2012 at 10:08 AM
Hi:
    Thanks for reporting the issue.
    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 Microsoft on 11/12/2012 at 2:33 AM
Thanks for your update. We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Rutix on 11/11/2012 at 1:15 PM
I attached a demo project. The project is basicly nothing more then the code I have above pasted in.
Posted by Microsoft on 11/9/2012 at 12:38 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. We are unable to reproduce the issue with the steps you provided.

Could you please give us a demo project to demonstrate this issue so that we can conduct further research?

Please submit this information to us within 4 business days. We look forward to hearing from you with this information.

Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 11/8/2012 at 2:50 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)