From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 81CB33857B97; Thu, 4 Jan 2024 08:24:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81CB33857B97 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704356649; bh=m6wX4DRH7yC2D8nOQTT+27VqTa/a1o/bfUMk8K73RZU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Aqpf9nA+6yqL8FE3BGFnzGwQ7LhxXOuQFr3WRVF77uTCPPAo8K5zEhqWdWGrNui8S WAbcroN8XgvyErkdTEf5fikDjWKc7bcqIEljqaDzGPvg/yKsNXxm13VpIAXzbxi+yi HLSkSnCGkyIcnCVywXpnGriiFWZrwNq86hz79vu8= From: "m.cencora at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113064] assignement from temporary sometimes invokes copy-assign instead of move-assign operator Date: Thu, 04 Jan 2024 08:24:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: m.cencora at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D113064 --- Comment #11 from m.cencora at gmail dot com --- This is surprising to say the least because apparently for following code (where both conversion operators return same type) the compiler somehow correctly chooses && qualified overload: struct bar { bar() =3D default; bar(const bar&); bar(bar&&); bar& operator=3D(const bar&); bar& operator=3D(bar&&); }; struct foo { operator bar() const &; operator bar() &&; }; void test() { bar a =3D foo{}; // ok a =3D foo{}; foo f; a =3D f; // ok } So why cannot it apply the same overload resolution, when conversion operat= ors return different type as in comment #4? Do you think this qualifies for a defect report?=