Visual C++: Copy Constructor Bug for Base Class with Template Constructor - by Victor Scherba

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 651972 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 3/17/2011 5:29:12 AM
Access Restriction Public


struct base
    base() {}

    base(const base&) {}

    template <class Other>
    base(const Other&) {}

struct derived : base

derived der1, der2(der1); // invokes template constuctor instead of copy constructor, what is wrong.

I have checked it on GCC and Comeau compilers, and them works without this bug.
This bug, for example, does not it possible to inherit boost::function class template properly.

I seem, when compiler generates default copy constructor for derived class it pass into base constructor parameter of a derived type considering implicit upcasting. But I can be wrong.
Sign in to post a comment.
Posted by Microsoft on 9/17/2011 at 10:58 AM
Hi: this issue has been fixed. The fix should show up in a future release of Visual C++.

Thank you for reporting the issue.

Jonathan Caves
Visual C++ Compiler Team
Posted by Noah Roberts on 4/21/2011 at 9:58 AM
Probably related to a bug I posted a while back:
Posted by Microsoft on 3/17/2011 at 8:01 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/17/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(