public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "leduyquang753 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106775] New: [11/12 regression] Subscipt operator with array rvalue inside brackets returns lvalue Date: Tue, 30 Aug 2022 02:49:35 +0000 [thread overview] Message-ID: <bug-106775-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106775 Bug ID: 106775 Summary: [11/12 regression] Subscipt operator with array rvalue inside brackets returns lvalue Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: leduyquang753 at gmail dot com Target Milestone: --- Created attachment 53519 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53519&action=edit The command-line invocation of GCC, its verbose output and the preprocessed source. Using the built-in subscript operator with an array rvalue to the left (outside brackets) and an integer to the right (inside brackets) returns an xvalue as expected: test.cpp:10:21: error: using rvalue as lvalue [-fpremissive] 10 | getAnA().b[0] = 1; | ~~~~~~~~~~~~^ But reversing the two operands makes GCC give an lvalue: 0[getAnA().b] = 1; No diagnostic with -Wall -Wextra -pedantic. (Full preprocessed code attached.) Test compiled using GCC 12.2.0 on Arch Linux and additionally on Windows and Compiler explorer. Previous versions of GCC were tested on Compiler explorer using x86-64 arch. Other notes: MSVC in Visual studio 2022 seems to have the same issue while Clang 14 doesn't.
next reply other threads:[~2022-08-30 2:49 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-30 2:49 leduyquang753 at gmail dot com [this message] 2022-08-30 7:11 ` [Bug c++/106775] [11/12/13 " rguenth at gcc dot gnu.org 2022-08-30 12:59 ` [Bug c++/106775] [10/11/12/13 " mpolacek at gcc dot gnu.org 2022-08-30 13:10 ` mpolacek at gcc dot gnu.org 2022-08-30 17:02 ` jakub at gcc dot gnu.org 2022-10-19 7:05 ` rguenth at gcc dot gnu.org 2023-05-29 10:07 ` [Bug c++/106775] [10/11/12/13/14 " jakub 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-106775-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: 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).