This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13275] [3.4 regression] Implementation of offsetof macro
- From: "nathan at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2003 08:58:49 -0000
- Subject: [Bug c++/13275] [3.4 regression] Implementation of offsetof macro
- References: <20031203003343.13275.jbrandmeyer@earthlink.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From nathan at gcc dot gnu dot org 2003-12-03 08:58 -------
I have come to the conclusion that one *cannot* implement offsetof without
a builtin of some kind. You need something like
#define offsetof(type,member) \
__builtin_offsetof (__builtin_offset_obj(type).member)
You need cooperation from the parser, so that the .MEMBER part is
looked up in the context of TYPE - hence the __builtin_offset_obj part.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13275