public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100975] New: [C++23] Allow pointer to array of auto
@ 2021-06-08 17:44 jason at gcc dot gnu.org
2021-06-08 17:46 ` [Bug c++/100975] " mpolacek at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-08 17:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
Bug ID: 100975
Summary: [C++23] Allow pointer to array of auto
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jason at gcc dot gnu.org
Blocks: 98940
Target Milestone: ---
https://wg21.link/cwg2397
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98940
[Bug 98940] Implement C++23 language features
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
@ 2021-06-08 17:46 ` mpolacek at gcc dot gnu.org
2021-06-08 18:43 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-08 17:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-06-08
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
2021-06-08 17:46 ` [Bug c++/100975] " mpolacek at gcc dot gnu.org
@ 2021-06-08 18:43 ` jason at gcc dot gnu.org
2021-06-25 19:02 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-08 18:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
int a[3];
auto (*p)[3] = &a;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
2021-06-08 17:46 ` [Bug c++/100975] " mpolacek at gcc dot gnu.org
2021-06-08 18:43 ` jason at gcc dot gnu.org
@ 2021-06-25 19:02 ` mpolacek at gcc dot gnu.org
2021-06-29 15:49 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-25 19:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Looks like just disabling the check in create_array_type_for_decl lets us
compile:
struct false_type { static constexpr bool value = false; };
struct true_type { static constexpr bool value = true; };
template<class T, class U>
struct is_same : false_type {};
template<class T>
struct is_same<T, T> : true_type {};
void
g ()
{
int a[3];
auto (*p)[3] = &a;
auto (&r)[3] = a;
static_assert (is_same<decltype (p), int(*)[3]>::value);
static_assert (is_same<decltype (r), int(&)[3]>::value);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
` (2 preceding siblings ...)
2021-06-25 19:02 ` mpolacek at gcc dot gnu.org
@ 2021-06-29 15:49 ` mpolacek at gcc dot gnu.org
2021-06-30 16:17 ` cvs-commit at gcc dot gnu.org
2021-06-30 16:19 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-29 15:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
` (3 preceding siblings ...)
2021-06-29 15:49 ` mpolacek at gcc dot gnu.org
@ 2021-06-30 16:17 ` cvs-commit at gcc dot gnu.org
2021-06-30 16:19 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-30 16:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:e66d0b7b87d105d24da8c4784a0b907fb6b2c095
commit r12-1933-ge66d0b7b87d105d24da8c4784a0b907fb6b2c095
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Jun 29 14:30:51 2021 -0400
c++: DR2397 - auto specifier for * and & to arrays [PR100975]
This patch implements DR2397, which removes the restriction in
[dcl.array]p4 that the array element type may not be a placeholder
type. We don't need to worry about decltype(auto) here, so this
allows code like
int a[3];
auto (*p)[3] = &a;
auto (&r)[3] = a;
However, note that
auto (&&r)[2] = { 1, 2 };
auto arr[2] = { 1, 2 };
still doesn't work (although one day it might) and neither does
int arr[5];
auto x[5] = arr;
given that auto deduction is performed in terms of function template
argument deduction, so the array decays to *.
PR c++/100975
DR 2397
gcc/cp/ChangeLog:
* decl.c (create_array_type_for_decl): Allow array of auto.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/auto24.C: Remove dg-error.
* g++.dg/cpp0x/auto3.C: Adjust dg-error.
* g++.dg/cpp0x/auto42.C: Likewise.
* g++.dg/cpp0x/initlist75.C: Likewise.
* g++.dg/cpp0x/initlist80.C: Likewise.
* g++.dg/diagnostic/auto1.C: Remove dg-error.
* g++.dg/cpp23/auto-array.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/100975] [C++23] Allow pointer to array of auto
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
` (4 preceding siblings ...)
2021-06-30 16:17 ` cvs-commit at gcc dot gnu.org
@ 2021-06-30 16:19 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-06-30 16:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100975
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Implemented in GCC 12.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-06-30 16:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-08 17:44 [Bug c++/100975] New: [C++23] Allow pointer to array of auto jason at gcc dot gnu.org
2021-06-08 17:46 ` [Bug c++/100975] " mpolacek at gcc dot gnu.org
2021-06-08 18:43 ` jason at gcc dot gnu.org
2021-06-25 19:02 ` mpolacek at gcc dot gnu.org
2021-06-29 15:49 ` mpolacek at gcc dot gnu.org
2021-06-30 16:17 ` cvs-commit at gcc dot gnu.org
2021-06-30 16:19 ` mpolacek at gcc dot gnu.org
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).