Debian Codegraph @

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

raw
1 /*
2 TEST_OUTPUT:
3 ----
4 fail_compilation/ice9540.d(36): Error: function `dg` is not callable using argument types `()`
5 fail_compilation/ice9540.d(36): too few arguments, expected 1, got 0
6 fail_compilation/ice9540.d(33): `ice9540.A.test.AddFront!(this, f).AddFront.dg(int __param_0)` declared here
7 fail_compilation/ice9540.d(27): Error: template instance `ice9540.A.test.AddFront!(this, f)` error instantiating
8 ----
9 */
10
11 template Tuple(E...) { alias E Tuple; }
12 alias Tuple!(int) Args;
13
14 void main() {
15 (new A).test ();
16 }
17
18 void test1 (int delegate (int) f) { f (-2); }
19
20 class A
21 {
22 int f (int a) {
23 return a;
24 }
25
26 void test () {
27 test1 (&AddFront!(this, f));
28 }
29 }
30
31 template AddFront (alias ctx, alias fun) {
32 auto AddFront(Args args) {
33 auto dg (Args dgArgs) {
34 return fun (dgArgs);
35 }
36 dg.ptr = ctx;
37 return dg(args);
38 }
39 }