This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53654] move constructor incorrectly delete copy constructor defined by template
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 13 Jun 2012 08:48:44 +0000
- Subject: [Bug c++/53654] move constructor incorrectly delete copy constructor defined by template
- Auto-submitted: auto-generated
- References: <bug-53654-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53654
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-13 08:48:44 UTC ---
This behaviour is correct and required by the standard.
The template constructor is not a copy constructor, so a copy constructor is
still implicitly-declared and defined as deleted. The standard says
[class.copy]/2 "A non-template constructor for class X is a copy constructor if
its first parameter is of type X&, const X&, volatile X& or const volatile X&,
and either there are no other parameters or else all other parameters have
default values."
Your workaround is necessary (and exactly that change has been made to GCC's
own shared_ptr)
shared_ptr(const shared_ptr&) noexcept = default;