public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ndkrempel at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94264] New: Array-to-pointer conversion not performed on array prvalues Date: Mon, 23 Mar 2020 00:21:15 +0000 [thread overview] Message-ID: <bug-94264-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94264 Bug ID: 94264 Summary: Array-to-pointer conversion not performed on array prvalues Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ndkrempel at gmail dot com Target Milestone: --- I think the most clearcut example is: int main() { using T = int[]; T{1, 2} == nullptr; } This compiles fine with clang, and is supported by the standard: the == operator explicitly performs array-to-pointer conversion (https://eel.is/c++draft/expr#eq-1), and array-to-pointer conversion is explicitly defined for rvalue arrays (https://eel.is/c++draft/expr#conv.array). Other examples (which again all compile with clang) are: +T{1, 2}; Here the standard wording seems to have a minor bug, as unary "+" does not explicitly perform the array-to-pointer conversion, and the general rubric for applying it (https://eel.is/c++draft/expr#basic.lval-6) only applies to glvalues as written. T{1, 2} + 1; Ditto. *(T{1, 2} + 1); Interesting as T{1, 2}[1] should be equivalent to this (modulo the value category of the result, https://eel.is/c++draft/expr#sub), yet the former is rejected by gcc and the latter accepted.
next reply other threads:[~2020-03-23 0:21 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-23 0:21 ndkrempel at gmail dot com [this message] 2020-04-18 16:33 ` [Bug c++/94264] " mpolacek at gcc dot gnu.org 2021-08-10 3:43 ` pinskia at gcc dot gnu.org 2021-10-02 20:01 ` pinskia at gcc dot gnu.org 2023-10-08 7:31 ` fchelnokov at gmail dot com 2023-10-09 2:07 ` de34 at live dot cn 2023-10-09 2:19 ` pinskia at gcc dot gnu.org 2023-11-28 18:05 ` jason at gcc dot gnu.org 2023-11-28 21:29 ` cvs-commit at gcc dot gnu.org 2023-12-08 18:34 ` cvs-commit at gcc dot gnu.org 2023-12-19 20:54 ` 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-94264-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).