+2018-01-15 Martin Sebor <msebor@redhat.com>
+
+ PR c++/83588
+ * class.c (find_flexarrays): Make a record of multiple flexible array
+ members.
+
2018-01-12 Jason Merrill <jason@redhat.com>
PR c++/83186 - ICE with static_cast of list-initialized temporary.
/* Flexible array members have no upper bound. */
if (fmem->array)
{
- /* Replace the zero-length array if it's been stored and
- reset the after pointer. */
if (TYPE_DOMAIN (TREE_TYPE (fmem->array)))
{
+ /* Replace the zero-length array if it's been stored and
+ reset the after pointer. */
fmem->after[bool (pun)] = NULL_TREE;
fmem->array = fld;
fmem->enclosing = pstr;
}
+ else if (!fmem->after[bool (pun)])
+ /* Make a record of another flexible array member. */
+ fmem->after[bool (pun)] = fld;
}
else
{
+2018-01-15 Martin Sebor <msebor@redhat.com>
+
+ PR c++/83588
+ * g++.dg/ext/flexary28.C: New test.
+
2018-01-15 Louis Krupp <louis.krupp@zoho.com>
PR fortran/82257
--- /dev/null
+// PR c++/83588 - struct with two flexible arrays causes an internal compiler
+// error
+// { dg-do compile }
+// { dg-options "-Wno-pedantic" }
+
+struct A {
+ int i;
+ int a[]; // { dg-error "flexible array member .A::a. not at end of .struct A." }
+ int b[];
+};
+
+struct B {
+ int i;
+ int a[]; // { dg-error "flexible array member .B::a. not at end of .struct B." }
+ int j;
+ int b[][2];
+};
+
+struct C {
+ int i;
+ struct {
+ int a[]; // { dg-error "flexible array member .C::<unnamed struct>::a. not at end of .struct C." }
+ };
+ int b[];
+};
+
+struct D {
+ int i;
+ struct {
+ int a[]; // { dg-error "flexible array member .D::<unnamed struct>::a. not at end of .struct D." }
+ } b[];
+ int c[];
+};
+
+struct E {
+ int i;
+ int a[0];
+ int b[]; // { dg-error "flexible array member .E::b. not at end of .struct E." }
+ int d[];
+};
+
+struct F {
+ int i;
+ int a[]; // { dg-error "flexible array member .F::a. not at end of .struct F." }
+ int b[], c[], d[];
+};