1 // https://issues.dlang.org/show_bug.cgi?id=21380
5 fail_compilation/test21380.d(39): Error: partial template instance `MySerializer().serializeSinkType!int` has no value
6 fail_compilation/test21380.d(44): Error: template instance `test21380.SupportSinkTypeSer!(MySerializer!int)` error instantiating
10 template isSomeFunction(T
...)
13 static if (is(typeof(& T
[0]) U
: U
*) && is(U
== function) ||
is(typeof(& T
[0]) U
== delegate))
15 // T is a (nested) function symbol.
16 enum bool isSomeFunction
= true;
18 else static if (is(T
[0] W
) ||
is(typeof(T
[0]) W
))
20 // T is an expression or a type. Take the type of it and examine.
21 static if (is(W F
: F
*) && is(F
== function))
22 enum bool isSomeFunction
= true; // function pointer
24 enum bool isSomeFunction
= is(W
== function) ||
is(W
== delegate);
27 enum bool isSomeFunction
= false;
30 struct MySerializer (T
)
32 void serializeSinkType(T2
) (scope auto ref T2 record
) {}
35 template SupportSinkTypeSer(SerT
)
37 /* Note: Partial template instance because it needs inference, in this case
38 it cannot infer 'auto ref' parameter */
39 enum SupportSinkTypeSer
= isSomeFunction
!(SerT
.init
.serializeSinkType
!int);
44 enum x
= SupportSinkTypeSer
!(MySerializer
!int);