[Bug c++/116162] GCC rejects explicitly default move ctor with const X&& parameter

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 31 17:23:14 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116162

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Why do you think this is valid?
https://eel.is/c++draft/class.copy.ctor#9
says implicitly declared move constructor has
X::X(X&&)
form and
https://eel.is/c++draft/dcl.fct.def#default-2
defines rules under which the explicitly defaulted declaration can differ from
the implicitly declared one.
For copy constructors there is the
https://eel.is/c++draft/dcl.fct.def#default-2.4
rule that if the implicitly declared would have const C & argument, the
explicitly defaulted can have C & argument, but there is no such exception for
&& and it would need to be in the other direction anyway.


More information about the Gcc-bugs mailing list