Skip to content

Commit

Permalink
Merge pull request #3179 from 9rnsr/fix12038
Browse files Browse the repository at this point in the history
Issue 12038 - alias this and &this cause ICE
  • Loading branch information
WalterBright committed Jan 31, 2014
2 parents 23f9312 + 033a1bf commit 7e97423
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mtype.c
Expand Up @@ -8741,7 +8741,7 @@ unsigned char TypeStruct::deduceWild(Type *t, bool isRef)

unsigned char wm = 0;

if (sym->aliasthis && !(att & RECtracing))
if (t->hasWild() && sym->aliasthis && !(att & RECtracing))
{
att = (AliasThisRec)(att | RECtracing);
wm = aliasthisOf()->deduceWild(t, isRef);
Expand Down Expand Up @@ -9285,7 +9285,7 @@ unsigned char TypeClass::deduceWild(Type *t, bool isRef)

unsigned char wm = 0;

if (sym->aliasthis && !(att & RECtracing))
if (t->hasWild() && sym->aliasthis && !(att & RECtracing))
{
att = (AliasThisRec)(att | RECtracing);
wm = aliasthisOf()->deduceWild(t, isRef);
Expand Down
11 changes: 11 additions & 0 deletions test/runnable/aliasthis.d
Expand Up @@ -1674,6 +1674,17 @@ struct Group12008
RefCounted12008!SharedInput12008 _allGroups;
}

/***************************************************/
// 12038

bool f12038(void* p) { return true; }

struct S12038
{
@property p() { f12038(&this); }
alias p this;
}

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

int main()
Expand Down

0 comments on commit 7e97423

Please sign in to comment.