Skip to content

Commit

Permalink
fix Issue 12203 - typeof(null) does not convert to "void delegate(flo…
Browse files Browse the repository at this point in the history
…at)"
  • Loading branch information
9rnsr committed Feb 20, 2014
1 parent 544577d commit 1c50c4f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/e2ir.c
Expand Up @@ -4223,6 +4223,7 @@ elem *toElem(Expression *e, IRState *irs)

case X(Tnull, Tarray):
case X(Tnull, Taarray):
case X(Tnull, Tdelegate):
goto Lzero;

/* ============================= */
Expand Down
16 changes: 16 additions & 0 deletions test/runnable/nulltype.d
Expand Up @@ -153,6 +153,21 @@ void test9385()
assert(!null);
}

/**********************************************/
// 12203

void test12203()
{
typeof(null) v;
void foo(float) {}
void delegate(float) dg = &foo;
assert(dg !is null);

dg = v; // Error: e2ir: cannot cast v of type typeof(null) to type void delegate(float)

assert(dg is null);
}

/**********************************************/

int main()
Expand All @@ -163,6 +178,7 @@ int main()
test8221();
test8589();
test9385();
test12203();

printf("Success\n");
return 0;
Expand Down

0 comments on commit 1c50c4f

Please sign in to comment.