[C++ PATCH] C++2A P0386R1 - default member initializers for bit-fields

Nathan Sidwell nathan@acm.org
Wed Sep 27 14:55:00 GMT 2017


Jakub,
> The following patch implements P0386R1 - NSDMIs for bit-fields.
> While working on that, I've discovered our parser mishandles attributes
> on bitfields, already C++11 says:
> identifier[opt] attribute-specifier-seq[opt] : constant-expression
> in the grammar, but we actually parsed
> identifier[opt] : constant-expression attribute-specifier-seq[opt]

I'm sorry for my tardiness.  It think the patch would be better broken 
apart:
	1) fix the parsing bug you found and move to (ab)using 
DECL_BIT_FIELD_REPRESENTATIVE

	2) the new c++2a feature

Is that feasible?

WRT your questions

  1, I think a default strict arg on cp_parser_constant_expression is 
the way to go.  That makes it clear that its default behaviour is 
'sloppy', saving someone the detective work you've done.

  2.  I'm all for a pedwarn, Jason is often more conservative than me 
though.

  3.  D_B_F_R is quite probably fine -- you'll know better than me, 
having poked at it

  4. They are not valid on unamed bitfields.  You may have spotted an 
inconsistency in the spec.

nathan

-- 
Nathan Sidwell



More information about the Gcc-patches mailing list