From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B26F23858423; Wed, 5 Jul 2023 19:36:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B26F23858423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688585801; bh=sg6KnKm+92e4JGBF0ceMDBZ/YS7OBhYOJQsTBCHNqiI=; h=From:To:Subject:Date:From; b=UOTskHelMTtI/BFmON4Ixi1sGWmgnqTlZDJDyFoYds3wC9pCsEVZFIatysZmE/QSD PutG7RU+JXG3Q6yXtIejaCtmxcP7h037fE236ezmDKr1gzoSdXl/6anuyenNNfhmoJ Vo35MLKNiJEKbho4Hd/wbPN9Wikl5VcRK/zqWSbA= From: "blubban at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110565] New: Incomplete note on why initializing int& with int is ill-formed Date: Wed, 05 Jul 2023 19:36:41 +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: blubban 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=3D110565 Bug ID: 110565 Summary: Incomplete note on why initializing int& with int is ill-formed Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: blubban at gmail dot com Target Milestone: --- struct X { X(int&); X(X&&) =3D delete; // the issue reproduces without this line, but the e= rror is clearer with it }; template void f() { new X(0); } Expected output: : In function 'void f()': :8:12: error: no matching function for call to 'X::X(int)' 8 | new X(0); | ^ :2:5: note: candidate: 'X::X(int&)' (near match) 2 | X(int&); | ^ :2:5: note: conversion of argument 1 would be ill-formed: :8:11: error: cannot bind non-const lvalue reference of type 'int&'= to an rvalue of type 'int' Actual output: : In function 'void f()': :8:12: error: no matching function for call to 'X::X(int)' 8 | new X(0); | ^ :2:5: note: candidate: 'X::X(int&)' (near match) 2 | X(int&); | ^ :2:5: note: conversion of argument 1 would be ill-formed: The template and new-expression are necessary; the error is proper without them. https://godbolt.org/z/c1Er5nsjd=