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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to John Drouhard from comment #6)
> (In reply to Boris Staletic from comment #3)
> > > test.cpp:7:3: error: uncaught exception of type 'std::meta::exception'; 
> > > 'what()': 'neither name nor bit_width specified'
> > 
> > That's expected. It's a later change in the proposal that clang-p2996 fork
> > has not implemented.
> > 
> > An empty name implies an anonymous bit field. An empty bit_width implies a
> > non-bit field.
> 
> Ok, that seems like an invalid assumption.

No, it is a requirement of the standard.

> An empty name doesn’t imply an
> anonymous bit field. How would you define an aggregate with fields you don’t
> need to access by name but aren’t bit fields? For instance, defining a
> struct, or union you’d pair with an index and only access the fields by that
> index (to implement tuple or a tagged union/variant)?

By using placeholder name?  I.e. {.name="_"}

Reply via email to