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++/100975] [C++23] Allow pointer to array of auto
Date: Wed, 30 Jun 2021 16:17:57 +0000	[thread overview]
Message-ID: <bug-100975-4-rdGT7iTolv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100975-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2021-06-30 16:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 17:44 [Bug c++/100975] New: " 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 [this message]
2021-06-30 16:19 ` mpolacek 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-100975-4-rdGT7iTolv@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: link
Be 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).