... by the way, I don't understand why we are appending the constructor at all for the unnamed bit-field?!? Eg, what about the below?

Thanks,
Paolo.

////////////////////
Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c        (revision 207199)
+++ cp/typeck2.c        (working copy)
@@ -1268,11 +1268,7 @@ process_init_constructor_record (tree type, tree i
       tree type;
 
       if (!DECL_NAME (field) && DECL_C_BIT_FIELD (field))
-       {
-         flags |= picflag_from_initializer (integer_zero_node);
-         CONSTRUCTOR_APPEND_ELT (v, field, integer_zero_node);
-         continue;
-       }
+       continue;
 
       if (TREE_CODE (field) != FIELD_DECL || DECL_ARTIFICIAL (field))
        continue;
Index: testsuite/g++.dg/init/bitfield5.C
===================================================================
--- testsuite/g++.dg/init/bitfield5.C   (revision 0)
+++ testsuite/g++.dg/init/bitfield5.C   (working copy)
@@ -0,0 +1,12 @@
+// PR c++/51219
+
+struct A
+{
+  int i;
+  int : 8;
+};
+
+void foo()
+{
+  A a = { 0 };
+}

Reply via email to