[Bug c++/85033] internal compiler error: in fold_offsetof_1, at c-family/c-common.c:6269
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 22 18:09:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85033
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Started to ICE with r82549 when __builtin_offsetof has been introduced.
>
> Wouldn't
> error: ‘struct <anonymous>’ has no member named ‘a’
> that the C FE emits be better?
That's exactly what I tried the first time. But lookup in C/C++ is different,
in C++ it happily finds 'X' in
struct S {
enum { X };
};
int
foo (struct S s)
{
return s.X;
}
unlike the C FE. I admit I didn't know this was possible.
> Or is a still a member of the struct in C++,
> just not a non-static data member?
> Though, for
> int c = __builtin_offsetof(struct S { static int i; }, i);
> we emit
> error: cannot apply ‘offsetof’ to static data member ‘S::i’
> so perhaps your message is more descriptive.
We'll see on the ML what others think.
More information about the Gcc-bugs
mailing list