d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test23651.d
blob8c477b0c0b6e4085417859878a8367f6e16bb3b1
1 // https://issues.dlang.org/show_bug.cgi?id=23651
3 template isCallable(alias callable)
5 static if (is(typeof(&callable!())))
6 enum bool isCallable = isCallable!(typeof(&callable!()));
7 else
8 enum bool isCallable = true;
11 string foo();
13 template FunctionTypeOf(alias func)
14 if (isCallable!func)
16 alias FunctionTypeOf = typeof(foo);
19 template ReturnType(alias func)
21 static if (is(FunctionTypeOf!func R == return))
22 alias ReturnType = R;
25 template isAttrRange()
27 alias NameType = ReturnType!((string r) => r);
28 //pragma(msg, "isAttrRange ", NameType, " ", string);
29 static assert(is(NameType == string));
31 enum isAttrRange = is(NameType == string);
34 static assert(isAttrRange!());