Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.bugs/900321_01.C

raw
1 // { dg-do assemble }
2 // g++ 1.37.1 bug 900321_01
3
4 // cfront flags ERRORs on each of the lines indicated below. g++ does not
5 // flag either ERRORs or warnings.
6
7 // Although I cannot find where in the current C++ Reference Manual this
8 // topic is covered, I am sure that these statements should get ERRORs in
9 // a "strongly typed" language.
10
11 // Cfront 2.0 passes this test.
12
13 // keywords: array types, array bound, pointers
14
15 int (*ptr_to_array_of_ints)[];
16 int (*ptr_to_array_of_3_ints) [3];
17 int (*ptr_to_array_of_5_ints) [5];
18
19 void function_0 ()
20 {
21 // we miss the first two because typeck.c (comp_array_types) deems
22 // it okay if one of the sizes is null
23 ptr_to_array_of_ints = ptr_to_array_of_3_ints; // { dg-error "conversions to arrays" "" { target c++17_down } }
24 ptr_to_array_of_3_ints = ptr_to_array_of_ints; // { dg-error "" }
25
26 ptr_to_array_of_3_ints = ptr_to_array_of_5_ints; // { dg-error "" }
27 ptr_to_array_of_5_ints = ptr_to_array_of_3_ints; // { dg-error "" }
28 }
29
30 int main () { return 0; }