Skip to content

Commit

Permalink
Fix issue 14185 [ICE] [mtype.c] compiler segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Fomin committed May 12, 2015
1 parent acbe13e commit d9a5eed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,8 @@ Type *Type::aliasthisOf()
if (fd)
{
t = fd->type->nextOf();
if (!t) // issue 14185
return Type::terror;
t = t->substWildTo(mod == 0 ? MODmutable : mod);
}
else
Expand Down
24 changes: 24 additions & 0 deletions test/fail_compilation/ice14185.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice14185.d(12): Error: cannot implicitly convert expression (this) of type Mutexed to Mutexed*
---
*/

struct Mutexed
{
auto acquire ()
{
return Lock (this);
}
alias acquire this;

struct Lock
{
Mutexed* source;
}
}
void main ()
{
Mutexed x;
}

0 comments on commit d9a5eed

Please sign in to comment.