https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108896

--- Comment #21 from Martin Uecker <muecker at gwdg dot de> ---
(In reply to Jakub Jelinek from comment #19)
> (In reply to Bill Wendling from comment #18)
> > > This is not the case in C: https://godbolt.org/z/P7M6cdnoa
> > > 
> > Right, it's not legal C syntax. I wanted to point out that it's not an
> > impossible syntax. The lexer and parser have no idea of, nor should they
> > care about, legal types, complete struct definitions, etc. All it sees is a
> 
> They do though, in lots of ways.  The reason it works in C++ is that the
> language
> explicitly requires it and the parser just needs to save token sequences of
> NSDMIs and
> member functions defined inside of class and parse them when the class is
> complete.
> We don't want to do that in C.

For the parser I have a prototype. It only works for size expressions using
members that came before in the source and not members which are not yet
declared. For flexible array members this is sufficient. It works by storing
the field decl in a list during declaration of struct and then uses the list to
lookup the field decl in build_component_ref. 

Martin

Reply via email to