File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1819,6 +1819,10 @@ if (isCallable!(F))
18191819 {
18201820 return toDelegate (&fp.opCall );
18211821 }
1822+ else static if (is (typeof (&fp.opCall ! ())))
1823+ {
1824+ return toDelegate (&fp.opCall ! ());
1825+ }
18221826 else
18231827 {
18241828 alias DelType = typeof (&(new DelegateFaker! (F)).doIt);
@@ -1949,6 +1953,20 @@ if (isCallable!(F))
19491953 }
19501954}
19511955
1956+
1957+ @system unittest
1958+ {
1959+ static struct S1 { static void opCall ()() { } }
1960+ static struct S2 { static T opCall (T = int )(T x) {return x; } }
1961+
1962+ S1 i1;
1963+ const dg1 = toDelegate(i1);
1964+ dg1();
1965+
1966+ S2 i2;
1967+ assert (toDelegate(i2)(0xBED ) == 0xBED );
1968+ }
1969+
19521970/**
19531971 * Passes the fields of a struct as arguments to a function.
19541972 *
You can’t perform that action at this time.
0 commit comments