public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95942] New: [11 regression] offsetof on an array: error: 'e' is not a constant expression
@ 2020-06-27 18:22 slyfox at inbox dot ru
  2020-06-27 18:29 ` [Bug c++/95942] " slyfox at inbox dot ru
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: slyfox at inbox dot ru @ 2020-06-27 18:22 UTC (permalink / raw)
  To: gcc-bugs

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?

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-02-07 15:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 18:22 [Bug c++/95942] New: [11 regression] offsetof on an array: error: 'e' is not a constant expression slyfox at inbox dot ru
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

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).