comparison gcc/testsuite/g++.dg/ext/desig2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
10 10
11 __extension__ int i[4] = { [0] = 1, [1] = 2 }; 11 __extension__ int i[4] = { [0] = 1, [1] = 2 };
12 12
13 // Currently, except for unions, the C++ front end only supports 13 // Currently, except for unions, the C++ front end only supports
14 // designators that designate the element that would have been initialized 14 // designators that designate the element that would have been initialized
15 // anyway. While that's true, make sure that we get a sorry rather than 15 // anyway, except that C++2A designators can skip over some direct
16 // bad code. 16 // non-static data members. While that's true, make sure that we get
17 // a sorry rather than bad code.
17 18
18 struct A 19 struct A
19 { 20 {
20 int i; 21 int i;
21 int j; 22 int j;
22 }; 23 };
23 24
24 __extension__ A a = { .j = 1 }; // { dg-message "non-trivial" } 25 __extension__ A a = { .j = 1 };
26 __extension__ A b = { .j = 2, .i = 1 }; // { dg-error "designator order for field 'A::i' does not match declaration order in 'A'" }
25 __extension__ int j[2] = { [1] = 1 }; // { dg-message "non-trivial" } 27 __extension__ int j[2] = { [1] = 1 }; // { dg-message "non-trivial" }