From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 90A3C385841A; Fri, 30 Jun 2023 19:55:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90A3C385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688154932; bh=ivs1LuIEn4tKcE0ivSzY/hlF7087GpmJcP9y9Khe88I=; h=From:To:Subject:Date:From; b=hc4NRLOKcfvKRKsBmJf6NEkquq06jstSOHMsrkSq0Tl5aXhaaS/f/e9bZlQKg0tJj ByaID10b2MzB/md4bsDYaFG6dj2Ab8HYThlZzA3EWgbXxq8xRB08jZj4v8ZdIjOtGe Z316NMMJJZTajlI58qnuzw1b2XrXsIVjJAwl45kM= From: "eric.niebler at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110507] New: cannot initialize immovable type in a std::tuple Date: Fri, 30 Jun 2023 19:55:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eric.niebler at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110507 Bug ID: 110507 Summary: cannot initialize immovable type in a std::tuple Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: eric.niebler at gmail dot com Target Milestone: --- The following should work since C++17, when C++ got guaranteed copy elision. #include struct immovable { immovable() =3D default; immovable(immovable&&) =3D delete; }; struct init_immovable { operator immovable() const { return {}; } }; int main() { std::tuple m{init_immovable{}}; } result: In file included from :1: /opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple: In instantiation of 'constexpr std::_Head_base<_Idx, _Head, true>::_Head_base(_UHead&&) [with _UHead =3D init_immovable; long unsigned = int _Idx =3D 0; _Head =3D immovable]': /opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:514:38:= =20=20 required from here :13:43: in 'constexpr' expansion of 'm.std::tuple::tuple(init_immovable())' /opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:891:54: = in 'constexpr' expansion of '((std::_Tuple_impl<0, immovable>*)this)->std::_Tuple_impl<0, immovable>::_Tuple_impl((* & std::forward((= * & __elements#0))))' /opt/compiler-explorer/gcc-trunk-20230630/include/c++/14.0.0/tuple:92:11: error: use of deleted function 'immovable::immovable(immovable&&)' 92 | : _M_head_impl(std::forward<_UHead>(__h)) { } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :5:3: note: declared here 5 | immovable(immovable&&) =3D delete; | ^~~~~~~~~ https://godbolt.org/z/nfd1zdcqs=