On Fri, Mar 30, 2018 at 3:55 AM, Alexandre Oliva <aol...@redhat.com> wrote:
> Types defined within a __builtin_offsetof argument don't always get
> properly recorded as members of their context types, so if they're
> anonymous, we may fail to assign them an anon type index for mangling
> and ICE.
>
> We shouldn't allow types to be introduced in __builtin_offsetof, I
> think, so I've arranged for us to reject them.  Even then, we still
> parse the definitions and attempt to assign mangled names to its
> member functions, so the ICE remains.  Since we've already reported an
> error, we might as well complete the name assignment with an arbitrary
> index, thus avoiding the ICE.
>
>
> Regstrapped on i686- and x86_64-linux-gnu, regressing
> g++.dg/parse/semicolon3.C, which defines a (named) struct in
> builtin_offsetof.  I suppose this means I should look for another
> solution that doesn't involve rejecting these definitions, eh?

Hmm, I'm afraid so.  The C standard defines offsetof in terms of a
notional declaration

static /type/ t;

and a type definition is allowed in such a declaration.

Incidentally, it would be nice to replace all the
type_definition_forbidden stuff with defining-type-specifier as per DR
2141... (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50169)

Jason

Reply via email to