From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AAA90385840E; Fri, 12 Apr 2024 20:15:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AAA90385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712952937; bh=2Y0pqMzodc0dcWwtl6adTsWX8Xoak58YwAlNdNNNmpY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xUgeeWzCG8aunMVjWZgcrS++QaGpXTob/GXPdMyX6f/0Dq6N4tDMdOjV027pCZaF9 tkK+jjfu46ojQtPw8LsvJMcFubTLHu4yONF5PVyN0l/9EljU/OPiFMQDOJk+qSsyIK ns95/sVrF4Ok8EeIP9bmftjn6lMzPX2QKVVWNQDc= From: "ppalka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113141] [13/14 Regression] ICE on conversion to reference in aggregate initialization Date: Fri, 12 Apr 2024 20:15:36 +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.2.1 X-Bugzilla-Keywords: ice-on-invalid-code, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ppalka at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 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=3D113141 --- Comment #10 from Patrick Palka --- The master branch has been updated by Jason Merrill : https://gcc.gnu.org/g:df7bfdb7dbf2d46aa5768a0280d4dcfcc868b7f9 commit r14-9947-df7bfdb7dbf2d46aa5768a0280d4dcfcc868b7f9 Author: Jason Merrill Date: Wed Apr 10 15:12:26 2024 -0400 c++: reference cast, conversion fn [PR113141] The second testcase in 113141 is a separate issue: we first decide that= the conversion is ill-formed, but then when recalculating the special c_cas= t_p handling makes us think it's OK. We don't want that, it should continu= e to fall back to the reinterpret_cast interpretation. And while we're here, let's warn that we're not using the conversion function. Note that the standard seems to say that in this case we should treat (Matrix &) as const_cast(static_cast(X)= ), which would use the conversion operator, but that doesn't match existing practice, so let's resolve that another day. I've raised this issue wi= th CWG; at the moment I lean toward never binding a temporary in a C-style cast to reference type, which would also be a change from existing practice. PR c++/113141 gcc/c-family/ChangeLog: * c.opt: Add -Wcast-user-defined. gcc/ChangeLog: * doc/invoke.texi: Document -Wcast-user-defined. gcc/cp/ChangeLog: * call.cc (reference_binding): For an invalid cast, warn and do= n't recalculate. gcc/testsuite/ChangeLog: * g++.dg/conversion/ref12.C: New test. Co-authored-by: Patrick Palka =