view gcc/testsuite/g++.dg/ext/flexary25.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// PR c++/81922
// { dg-do compile }
// { dg-options "" }

struct S { const char *a; char b[]; };
struct T { int a; int b[]; };
#if __cplusplus >= 201103L
S c[] { "", "" };		// { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
S d[] { "", { 0 } };		// { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
T e[] { 1, { 2 }, 3, { 4 } };	// { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
T f[] { 1, {}, 3, {} };
T g { 1, { 1, 2, 3 } };
S h { "abcd", "" };
#endif
S i[] = { "", "", "", "" };	// { dg-error "initialization of flexible array member in a nested context" }
S j[] = { "", { 1 }, "", { 2, 3 } };	// { dg-error "initialization of flexible array member in a nested context" }
T k[] = { 1, { 2 }, 3, { 4 } };	// { dg-error "initialization of flexible array member in a nested context" }
T l[] = { 1, {}, 3, {} };
T m = { 1, { 1, 2, 3 } };
S n = { "", "abcde" };