MATCH: Improve `A CMP 0 ? A : -A` set of patterns to use bitwise_equal_p.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test21380.d
blob6a2da1b2132bb899fa6c0448e8952d3cf1e5bc75
1 // https://issues.dlang.org/show_bug.cgi?id=21380
2 /*
3 TEST_OUTPUT:
4 ---
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
7 ---
8 */
10 template isSomeFunction(T...)
11 if (T.length == 1)
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
23 else
24 enum bool isSomeFunction = is(W == function) || is(W == delegate);
26 else
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);
42 int main()
44 enum x = SupportSinkTypeSer!(MySerializer!int);
45 return 0;