public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94264] Array-to-pointer conversion not performed on array prvalues Date: Tue, 28 Nov 2023 21:29:26 +0000 [thread overview] Message-ID: <bug-94264-4-qMqHlWBZJq@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-94264-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94264 --- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>: https://gcc.gnu.org/g:305a2686c99bf9b57490419f25c79f6fb3ae0feb commit r14-5941-g305a2686c99bf9b57490419f25c79f6fb3ae0feb Author: Jason Merrill <jason@redhat.com> Date: Tue Nov 28 13:54:47 2023 -0500 c++: prvalue array decay [PR94264] My change for PR53220 made array to pointer decay for prvalue arrays ill-formed to catch well-defined C code that produces a dangling pointer in C++ due to the shorter lifetime of compound literals. This wasn't really correct, but wasn't a problem until C++17 added prvalue arrays, at which point it started rejecting valid C++ code. I wanted to make sure that we still diagnose the problematic code; -Wdangling-pointer covers the array-lit.c case, but I needed to extend -Wreturn-local-addr to handle the return case. PR c++/94264 PR c++/53220 gcc/c/ChangeLog: * c-typeck.cc (array_to_pointer_conversion): Adjust -Wc++-compat diagnostic. gcc/cp/ChangeLog: * call.cc (convert_like_internal): Remove obsolete comment. * typeck.cc (decay_conversion): Allow array prvalue. (maybe_warn_about_returning_address_of_local): Check for returning pointer to temporary. gcc/testsuite/ChangeLog: * c-c++-common/array-lit.c: Adjust. * g++.dg/cpp1z/array-prvalue1.C: New test. * g++.dg/ext/complit17.C: New test.
next prev parent reply other threads:[~2023-11-28 21:29 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-23 0:21 [Bug c++/94264] New: " ndkrempel at gmail dot com 2020-04-18 16:33 ` [Bug c++/94264] " mpolacek at gcc dot gnu.org 2021-08-10 3:43 ` pinskia at gcc dot gnu.org 2021-10-02 20:01 ` pinskia at gcc dot gnu.org 2023-10-08 7:31 ` fchelnokov at gmail dot com 2023-10-09 2:07 ` de34 at live dot cn 2023-10-09 2:19 ` pinskia at gcc dot gnu.org 2023-11-28 18:05 ` jason at gcc dot gnu.org 2023-11-28 21:29 ` cvs-commit at gcc dot gnu.org [this message] 2023-12-08 18:34 ` cvs-commit at gcc dot gnu.org 2023-12-19 20:54 ` jason 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-94264-4-qMqHlWBZJq@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).