diff options
author | Jason Merrill <jason@redhat.com> | 2023-11-28 13:54:47 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-11-28 16:29:19 -0500 |
commit | 305a2686c99bf9b57490419f25c79f6fb3ae0feb (patch) | |
tree | d6002e2cc5253350245349cd3d8e19767cd72d6e /gcc/cp/ChangeLog | |
parent | 3d104d93a7011146b0870ab160613147adb8d9b3 (diff) | |
download | gcc-305a2686c99bf9b57490419f25c79f6fb3ae0feb.zip gcc-305a2686c99bf9b57490419f25c79f6fb3ae0feb.tar.gz gcc-305a2686c99bf9b57490419f25c79f6fb3ae0feb.tar.bz2 |
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.
Diffstat (limited to 'gcc/cp/ChangeLog')
0 files changed, 0 insertions, 0 deletions