From: Martin Sebor Date: Tue, 27 Apr 2021 17:00:53 +0000 (-0600) Subject: Remove malformed dg-warning directives. X-Git-Tag: upstream/12.2.0~8530 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ae2a45c287d254c2890feff2cca46ed2ddb06ca;p=platform%2Fupstream%2Fgcc.git Remove malformed dg-warning directives. gcc/testsuite/ChangeLog: PR testsuite/100272 * g++.dg/ext/flexary13.C: Remove malformed directives. --- diff --git a/gcc/testsuite/g++.dg/ext/flexary13.C b/gcc/testsuite/g++.dg/ext/flexary13.C index f0603f9..1acfa2e 100644 --- a/gcc/testsuite/g++.dg/ext/flexary13.C +++ b/gcc/testsuite/g++.dg/ext/flexary13.C @@ -17,44 +17,40 @@ int32_t i = 12345678; int main () { { + // OK. Does not assign any elements to flexible array. Ax s = { 0 }; ASSERT (s.n == 0); } { - static Ax s = - { 0, { } }; // dg-warning "initialization of a flexible array member" } + // OK only for statically allocated objects, otherwise error. + static Ax s = { 0, { } }; ASSERT (s.n == 0); } { - static Ax s = - { 1, { 2 } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 1, { 2 } }; ASSERT (s.n == 1 && s.a [0] == 2); } { - static Ax s = - { 2, { 3, 4 } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 2, { 3, 4 } }; ASSERT (s.n = 2 && s.a [0] == 3 && s.a [1] == 4); } { - static Ax s = - { 123, i }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 123, i }; ASSERT (s.n == 123 && s.a [0] == i); } { - static Ax s = - { 456, { i } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 456, { i } }; ASSERT (s.n == 456 && s.a [0] == i); } { int32_t j = i + 1, k = j + 1; - static Ax s = - { 3, { i, j, k } }; // dg-warning "initialization of a flexible array member" } + static Ax s = { 3, { i, j, k } }; ASSERT (s.n == 3 && s.a [0] == i && s.a [1] == j && s.a [2] == k); } { - AAx s = - { 1, { 2 } }; // dg-warning "initialization of a flexible array member" } + // OK. Does not assign any elements to flexible array. + AAx s = { 1, { 2 } }; ASSERT (s.i == 1 && s.ax.n == 2); } }