From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CE59D3858D3C; Thu, 7 Dec 2023 21:51:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE59D3858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701985918; bh=i0MdMOF8aLtk3KLUUSGSQj2tdzCdtzPt0BOsF1+KGFQ=; h=From:To:Subject:Date:From; b=DRWH0+6ccvROYp5u5a0rOFK50IZano3416D9qSDIFTg4iLUY9VfirU4et31kN8RWF eomOQD2V7VpXClyu/ESl8sXWLZwV5Klcgnm6+eYAOoN0SSmdDr6KnNU7WFr5CPfid9 18tqYLWgQ8rSRJcxA7BYNz3DObQ0eIMHzcE7qYAE= From: "mital at mitalashok dot co.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112908] New: __reference_{converts,constructs}_from_temporary checks for move constructor when binding prvalue to reference of the same type Date: Thu, 07 Dec 2023 21:51:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mital at mitalashok dot co.uk 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=3D112908 Bug ID: 112908 Summary: __reference_{converts,constructs}_from_temporary checks for move constructor when binding prvalue to reference of the same type Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mital at mitalashok dot co.uk Target Milestone: --- The following compiles on trunk: struct NonMovable { NonMovable() =3D default; NonMovable(NonMovable&&) =3D delete; }; static_assert( __reference_converts_from_temporary(int&&, int)); static_assert(!__reference_converts_from_temporary(NonMovable&&, NonMovable)); static_assert( __reference_constructs_from_temporary(int&&, int)); static_assert(!__reference_constructs_from_temporary(NonMovable&&, NonMovable)); When the NonMovable assertions should fail because there *is* a temporary b= eing bound to a reference (in exactly the same way as the int case). We can observe it instantiating constructors that shouldn't be too: template struct S { template S(const S&&) noexcept(U()) {} }; static_assert(__reference_converts_from_temporary(const S&&, const S)); static_assert(__reference_converts_from_temporary(const S&&, con= st S)); Which complains about a conversion from void* to bool even though construct= ors shouldn't be looked at.=