public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16868] New: [3.4 regression] offsetof fails with array member
@ 2004-08-04  0:15 ppluzhnikov at charter dot net
  2004-08-04  0:17 ` [Bug c++/16868] " giovannibajo at libero dot it
  0 siblings, 1 reply; 2+ messages in thread
From: ppluzhnikov at charter dot net @ 2004-08-04  0:15 UTC (permalink / raw)
  To: gcc-bugs

The test case below fails with

off.cc: In function `int main()':
off.cc:11: error: an array reference cannot appear in a constant-expression

This is possibly a variant of bug 16681 "offsetof fails with constant member"

This used to work in g++-2.95.x and g++-3.3.x
In C-mode the test case compiles fine with all versions tested.

--- cut ---
#include <stddef.h>

typedef struct Foo {
    int x[2];
} FOO;


int main()
{
    size_t a = offsetof(FOO, x);    // ok
    size_t b = offsetof(FOO, x[1]); // fails with gcc-3.4.0
    return 0;
}
--- cut ---

-- 
           Summary: [3.4 regression] offsetof fails with array member
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ppluzhnikov at charter dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16868


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

* [Bug c++/16868] [3.4 regression] offsetof fails with array member
  2004-08-04  0:15 [Bug c++/16868] New: [3.4 regression] offsetof fails with array member ppluzhnikov at charter dot net
@ 2004-08-04  0:17 ` giovannibajo at libero dot it
  0 siblings, 0 replies; 2+ messages in thread
From: giovannibajo at libero dot it @ 2004-08-04  0:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-08-04 00:17 -------
I fixed this already for 3.4.1 and mainline. Thanks for your report anyway.

*** This bug has been marked as a duplicate of 14932 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16868


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

end of thread, other threads:[~2004-08-04  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-04  0:15 [Bug c++/16868] New: [3.4 regression] offsetof fails with array member ppluzhnikov at charter dot net
2004-08-04  0:17 ` [Bug c++/16868] " giovannibajo at libero dot it

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