This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Accept -> in offsetof member-designator (the same as `[0].', PR c/32084)


On Wed, Jan 7, 2009 at 1:34 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> For struct S { struct T { int i; } t[2]; } is
> offsetof (struct S, t->i) valid, as with static struct S s;
> &s.t->i is a valid address constant.  The following patch parses
> it in both C and C++ FEs as [0].  Bootstrapped/regtested on x86_64-linux,
> ok for trunk?


I think this will also accept:

struct S { struct T { int i; } *t; }

int a = offsetof (struct S, t->i);

Which is invalid code and why -> was being prevented from being parsed.

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]