Skip to content

Commit

Permalink
Merge pull request #3366 from CyberShadow/fix12302
Browse files Browse the repository at this point in the history
fix Issue 12302 - Assertion failure in expression.c (line 432) when using template isCallable
  • Loading branch information
9rnsr committed Mar 10, 2014
2 parents 753fba1 + df44fee commit 3e086a6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/compilable/compile1.d
Expand Up @@ -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;

0 comments on commit 3e086a6

Please sign in to comment.