public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100296] New: [10.x regression] offsetof with non-constant-expression offset no longer accepted in C++ mode
@ 2021-04-27 19:30 davem at devkitpro dot org
2021-04-27 19:39 ` [Bug c++/100296] " jakub at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: davem at devkitpro dot org @ 2021-04-27 19:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100296
Bug ID: 100296
Summary: [10.x regression] offsetof with
non-constant-expression offset no longer accepted in
C++ mode
Product: gcc
Version: 11.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: davem at devkitpro dot org
Target Milestone: ---
The following code compiles fine as C but produces " error: 'idx' is not a
constant expression" with gcc 11.1.0
#include <stdint.h>
#include <stddef.h>
struct foo
{
uint8_t things[12];
};
uintptr_t getThing(const unsigned idx)
{
return offsetof(struct foo, things[idx]);
}
The code compiles fine with gcc 6.x through 10.x
gcc 5.x says "error: 'idx' cannot appear in a constant-expression"
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/100296] [10.x regression] offsetof with non-constant-expression offset no longer accepted in C++ mode
2021-04-27 19:30 [Bug c++/100296] New: [10.x regression] offsetof with non-constant-expression offset no longer accepted in C++ mode davem at devkitpro dot org
@ 2021-04-27 19:39 ` jakub at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-27 19:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100296
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jakub at gcc dot gnu.org
Resolution|--- |DUPLICATE
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 95942 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-27 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 19:30 [Bug c++/100296] New: [10.x regression] offsetof with non-constant-expression offset no longer accepted in C++ mode davem at devkitpro dot org
2021-04-27 19:39 ` [Bug c++/100296] " jakub 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).