+2019-02-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/88380 - wrong-code with flexible array and NSDMI.
+ * typeck2.c (process_init_constructor_record): Skip flexarrays.
+
2019-02-20 will wray <wjwray@gmail.com>
PR c++/88572 - wrong handling of braces on scalar init.
else
return PICFLAG_ERRONEOUS;
}
+ /* Do nothing for flexible array members since they need not have any
+ elements. Don't worry about 'skipped' because a flexarray has to
+ be the last field. */
+ else if (TREE_CODE (fldtype) == ARRAY_TYPE && !TYPE_DOMAIN (fldtype))
+ continue;
/* Warn when some struct elements are implicitly initialized
- to zero. However, avoid issuing the warning for flexible
- array members since they need not have any elements. */
- if ((TREE_CODE (fldtype) != ARRAY_TYPE || TYPE_DOMAIN (fldtype))
- && (complain & tf_warning)
+ to zero. */
+ if ((complain & tf_warning)
&& !EMPTY_CONSTRUCTOR_P (init))
warning (OPT_Wmissing_field_initializers,
"missing initializer for member %qD", field);
--- /dev/null
+// PR c++/88380
+// { dg-do compile { target c++14 } }
+// { dg-options "" }
+
+struct S {
+ char uninit;
+ char initialised = 11;
+ char variable[];
+};
+
+constexpr S p {};
+#define SA(X) static_assert((X),#X)
+SA(p.initialised == 11);