public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at inbox dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95942] New: [11 regression] offsetof on an array: error: 'e' is not a constant expression Date: Sat, 27 Jun 2020 18:22:43 +0000 [thread overview] Message-ID: <bug-95942-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95942 Bug ID: 95942 Summary: [11 regression] offsetof on an array: error: 'e' is not a constant expression Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at inbox dot ru Target Milestone: --- The original error is seen on https://www.dolphin-emu.org/ project as a build error. Minimized example looks the following: """ // $ cat.bug.cc struct a { int b; char c[100]; }; unsigned long d(long e) { return __builtin_offsetof(a, c[e]); } """ OK: $ LANG=C g++-10.1.0 -c bug.cc -o bug.o OK: $ LANG=C clang++-10 -c bug.cc -o bug.o FAIL: $ LANG=C g++-11.0.0 -c bug.cc -o bug.o bug.cc: In function 'void d(long int)': bug.cc:8:42: error: 'e' is not a constant expression 8 | void d(long e) { __builtin_offsetof(a, c[e]); } | Who is wrong here? gcc-10 or gcc-11?
next reply other threads:[~2020-06-27 18:22 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-27 18:22 slyfox at inbox dot ru [this message] 2020-06-27 18:29 ` [Bug c++/95942] " slyfox at inbox dot ru 2020-06-27 18:34 ` mpolacek at gcc dot gnu.org 2020-06-29 10:37 ` rguenth at gcc dot gnu.org 2020-07-15 20:26 ` ppalka at gcc dot gnu.org 2020-07-15 20:56 ` slyfox at inbox dot ru 2020-07-15 21:09 ` jakub at gcc dot gnu.org 2020-10-12 12:51 ` rguenth at gcc dot gnu.org 2020-10-15 16:45 ` jason at gcc dot gnu.org 2020-10-15 21:40 ` slyfox at gcc dot gnu.org 2021-04-27 19:39 ` jakub at gcc dot gnu.org 2024-02-07 15:06 ` pinskia 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-95942-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).