public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "de34 at live dot cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103185] New: ind[arr] is rejected when arr is an array prvalue
Date: Thu, 11 Nov 2021 08:49:32 +0000	[thread overview]
Message-ID: <bug-103185-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103185

            Bug ID: 103185
           Summary: ind[arr] is rejected when arr is an array prvalue
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

With gcc 10 and later versions, the following program compiles in C++11/14
modes, but fails to compile in C++17 and later modes.

#include <type_traits>

int main()
{
    using intarr = int[];
    static_assert(std::is_same<decltype(0[intarr{0}]), int&&>::value, "");
}

It seems that arr[ind]("intarr{0}[0]") doesn't suffer from this bug.

Gcc 9 correctly accepted this code.

wandbox links:
gcc 12.0 (-std=c++17): https://wandbox.org/permlink/AQGr8pUXHQkPrJ9m
gcc 12.0 (-std=c++14): https://wandbox.org/permlink/aYpBwLVK8tsDHTl3
gcc 10.1 (-std=c++17): https://wandbox.org/permlink/nnWuZAawBZnrmHvN
gcc 10.1 (-std=c++14): https://wandbox.org/permlink/4fNJLiqU5VaMZPfm
gcc  9.3 (-std=c++17): https://wandbox.org/permlink/vugrP8zIzBSPiVup

Perhaps this bug is related to bug 94264 and bug 103183.

             reply	other threads:[~2021-11-11  8:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11  8:49 de34 at live dot cn [this message]
2023-11-28 17:11 ` [Bug c++/103185] [11/12/13/14 Regression] " ppalka at gcc dot gnu.org
2023-11-28 17:11 ` ppalka at gcc dot gnu.org
2023-12-19 20:58 ` jason at gcc dot gnu.org
2023-12-20 17:31 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:39 ` [Bug c++/103185] [11/12/13 " cvs-commit at gcc dot gnu.org
2024-01-24 19:40 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:45 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:45 ` 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-103185-4@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).