From df44feed6de7e7392d2a7b42c6a72ec385702c3a Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sun, 9 Mar 2014 23:09:42 +0000 Subject: [PATCH] fix Issue 12302 - Assertion failure in expression.c (line 432) when using template isCallable --- test/compilable/compile1.d | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/compilable/compile1.d b/test/compilable/compile1.d index 82c77cd459af..0e284fecaf44 100644 --- a/test/compilable/compile1.d +++ b/test/compilable/compile1.d @@ -499,3 +499,31 @@ static assert(is(E11554 == enum)); struct Bro11554(N...) {} static assert(!is(E11554 unused : Bro11554!M, M...)); + +/***************************************************/ +// 12302 + +template isCallable12302(T...) + if (T.length == 1) +{ + static if (is(typeof(& T[0].opCall) == delegate)) + enum bool isCallable12302 = true; + else + static if (is(typeof(& T[0].opCall) V : V*) && is(V == function)) + enum bool isCallable12302 = true; + else + enum bool isCallable12302 = true; +} + +class A12302 +{ + struct X {} + X x; + auto opDispatch(string s, TArgs...)(TArgs args) + { + mixin("return x."~s~"(args);"); + } +} + +A12302 func12302() { return null; } +enum b12302 = isCallable12302!func12302;