Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail332.d(26): Error: function `foo` is not callable using argument types `()`
5 fail_compilation/fail332.d(26): missing argument for parameter #1: `int __param_0`
6 fail_compilation/fail332.d(21): `fail332.foo(int __param_0, ...)` declared here
7 fail_compilation/fail332.d(27): Error: function `foo` is not callable using argument types `(typeof(null))`
8 fail_compilation/fail332.d(27): cannot pass argument `null` of type `typeof(null)` to parameter `int __param_0`
9 fail_compilation/fail332.d(21): `fail332.foo(int __param_0, ...)` declared here
10 fail_compilation/fail332.d(29): Error: function `baz` is not callable using argument types `(string)`
11 fail_compilation/fail332.d(29): cannot pass argument `""` of type `string` to parameter `int[] __param_0...`
12 fail_compilation/fail332.d(22): `fail332.baz(int[] __param_0...)` declared here
13 fail_compilation/fail332.d(30): Error: function `baz` is not callable using argument types `(int, typeof(null))`
14 fail_compilation/fail332.d(30): cannot pass argument `null` of type `typeof(null)` to parameter `int[] __param_0...`
15 fail_compilation/fail332.d(22): `fail332.baz(int[] __param_0...)` declared here
16 ---
17 */
18
19 import core.vararg;
20
21 void foo(int, ...) {}
22 void baz(int[]...) {}
23
24 void test()
25 {
26 foo();
27 foo(null);
28
29 baz("");
30 baz(3, null);
31 }
32
33 /*
34 TEST_OUTPUT:
35 ---
36 fail_compilation/fail332.d(60): Error: function `bar` is not callable using argument types `()`
37 fail_compilation/fail332.d(60): missing argument for parameter #1: `Object`
38 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
39 fail_compilation/fail332.d(61): Error: function `bar` is not callable using argument types `(int)`
40 fail_compilation/fail332.d(61): cannot pass argument `4` of type `int` to parameter `Object`
41 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
42 fail_compilation/fail332.d(62): Error: function `bar` is not callable using argument types `(typeof(null))`
43 fail_compilation/fail332.d(62): expected 2 variadic argument(s), not 0
44 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
45 fail_compilation/fail332.d(63): Error: function `bar` is not callable using argument types `(typeof(null), int)`
46 fail_compilation/fail332.d(63): expected 2 variadic argument(s), not 1
47 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
48 fail_compilation/fail332.d(64): Error: function `bar` is not callable using argument types `(typeof(null), int, string)`
49 fail_compilation/fail332.d(64): cannot pass argument `""` of type `string` to parameter `int[2]...`
50 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
51 fail_compilation/fail332.d(65): Error: function `bar` is not callable using argument types `(typeof(null), int, int, int)`
52 fail_compilation/fail332.d(65): expected 2 variadic argument(s), not 3
53 fail_compilation/fail332.d(56): `fail332.bar(Object, int[2]...)` declared here
54 ---
55 */
56 void bar(Object, int[2]...);
57
58 void test2()
59 {
60 bar();
61 bar(4);
62 bar(null);
63 bar(null, 2);
64 bar(null, 2, "");
65 bar(null, 2,3,4);
66 }