This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/53654] move constructor incorrectly delete copy constructor defined by template


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]