Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/diag_in_array.d

raw
1 /**
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag_in_array.d(17): Error: incompatible types for `(3) in (a)`: `int` and `int[4]`
5 fail_compilation/diag_in_array.d(17): `in` is only allowed on associative arrays
6 fail_compilation/diag_in_array.d(17): perhaps use `std.algorithm.find(3, a[])` instead
7 fail_compilation/diag_in_array.d(19): Error: incompatible types for `("s") in (b)`: `string` and `string[]`
8 fail_compilation/diag_in_array.d(19): `in` is only allowed on associative arrays
9 fail_compilation/diag_in_array.d(19): perhaps use `std.algorithm.find("s", b)` instead
10 ---
11 */
12
13 void main()
14 {
15 int[4] a;
16 string[] b;
17 if (3 in a)
18 return;
19 auto c = "s" in b;
20 }