blob: d6c9cdae0f3028b9c8f98d412f45bcb842dc146a [file] [log] [blame]
/*
TEST_OUTPUT:
---
fail_compilation/ice9540.d(34): Error: function ice9540.A.test.AddFront!(this, f).AddFront.dg (int _param_0) is not callable using argument types ()
fail_compilation/ice9540.d(25): Error: template instance ice9540.A.test.AddFront!(this, f) error instantiating
---
*/
template Tuple(E...) { alias E Tuple; }
alias Tuple!(int) Args;
void main() {
(new A).test ();
}
void test1 (int delegate (int) f) { f (-2); }
class A
{
int f (int a) {
return a;
}
void test () {
test1 (&AddFront!(this, f));
}
}
template AddFront (alias ctx, alias fun) {
auto AddFront(Args args) {
auto dg (Args dgArgs) {
return fun (dgArgs);
}
dg.ptr = ctx;
return dg(args);
}
}