From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 36C783858D20; Thu, 11 Apr 2024 18:33:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36C783858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712860403; bh=5uJMaop0DOzgwMx61Tf98+1gUNq9Z2jc8CKA+WcBDps=; h=From:To:Subject:Date:From; b=xE2tqF5QqBRL6IhNpo1tsYcp8LtQxnAE7N0LwanU1r+sBFjrfv5mnRky7wdg6+OGw XuNQTfMd1uB5jpg0TokLdZxJ3qV4elSDaErtNAknVyqQypY5XRpK1w9N8gLpJ2+XtA l6nm1OeFGQ1a4vfqs4FBlEscTY+G5jCslkSSQTZk= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114697] New: [DR 233] references in user defined conversions Date: Thu, 11 Apr 2024 18:33:22 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org 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=3D114697 Bug ID: 114697 Summary: [DR 233] references in user defined conversions Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- This should compile: ``` struct Z {}; struct A { operator Z&(); // #1 operator const Z&(); }; struct B { operator Z(); // #2 operator const Z&&(); }; const Z& r1 =3D A(); // OK, uses #1 const Z&& r2 =3D B(); // OK, uses #2 ``` but we reject it with: cwg233.C:13:15: error: conversion from =E2=80=98A=E2=80=99 to =E2=80=98cons= t Z&=E2=80=99 is ambiguous 13 | const Z& r1 =3D A(); // OK, uses #1 | ^~~ cwg233.C:4:3: note: candidate: =E2=80=98A::operator Z&()=E2=80=99 4 | operator Z&(); // #1 | ^~~~~~~~ cwg233.C:5:3: note: candidate: =E2=80=98A::operator const Z&()=E2=80=99 5 | operator const Z&(); | ^~~~~~~~=