Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/ext/flexary3.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
line wrap: on
line source
// PR c++/54441 - [4.7/4.8 Regression] Infinite loop with brace initializer // on zero-length array // Note that although the definition of struct s in the test case for // c++/54441 was accepted as valid, it is, in fact, invalid in C, and // as noted in c++/42121, should be treated as invalid in C++ as well. // The test verifies that gcc detects, reports, and handles both errors // gracefully. // Note also that the error(s) issued for the invalid initializer depend // on c++/55606. // { dg-options "" } struct s { char c[]; // { dg-error "flexible array member .* in an otherwise empty" } }; int main() { struct s s = { .c = 0 }; // { dg-error "initializer" } // { dg-error "non-static initialization of a flexible array member" "" { target *-*-* } .-1 } return 0; }