public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ppalka at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-113141-4-S5rxAobHxD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113141-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113141 --- Comment #10 from Patrick Palka <ppalka at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:df7bfdb7dbf2d46aa5768a0280d4dcfcc868b7f9 commit r14-9947-df7bfdb7dbf2d46aa5768a0280d4dcfcc868b7f9 Author: Jason Merrill <jason@redhat.com> 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_cast_p handling makes us think it's OK. We don't want that, it should continue 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<Matrix &>(static_cast<const Matrix &>(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 with 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 don't recalculate. gcc/testsuite/ChangeLog: * g++.dg/conversion/ref12.C: New test. Co-authored-by: Patrick Palka <ppalka@redhat.com>
next prev parent reply other threads:[~2024-04-12 20:15 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-26 1:36 [Bug c++/113141] New: " de34 at live dot cn 2023-12-26 5:12 ` [Bug c++/113141] " pinskia at gcc dot gnu.org 2023-12-26 5:14 ` [Bug c++/113141] [13/14 Regression] " pinskia at gcc dot gnu.org 2024-01-02 18:25 ` ppalka at gcc dot gnu.org 2024-01-24 7:48 ` slyfox at gcc dot gnu.org 2024-01-24 15:47 ` ppalka at gcc dot gnu.org 2024-03-07 20:53 ` law at gcc dot gnu.org 2024-03-12 13:21 ` jakub at gcc dot gnu.org 2024-03-14 18:27 ` pinskia at gcc dot gnu.org 2024-03-21 9:07 ` pinskia at gcc dot gnu.org 2024-04-12 20:14 ` ppalka at gcc dot gnu.org 2024-04-12 20:15 ` ppalka at gcc dot gnu.org [this message] 2024-05-01 22:16 ` [Bug c++/113141] [13 " cvs-commit at gcc dot gnu.org 2024-05-01 22:19 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113141-4-S5rxAobHxD@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).