From 033a1bfa360153b88bbd80c61012bd282f26b0d9 Mon Sep 17 00:00:00 2001 From: k-hara Date: Thu, 30 Jan 2014 18:07:31 +0900 Subject: [PATCH] fix Issue 12038 - alias this and &this cause ICE --- src/mtype.c | 4 ++-- test/runnable/aliasthis.d | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/mtype.c b/src/mtype.c index bd4bb93be384..53118c7d97f3 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -8729,7 +8729,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); @@ -9273,7 +9273,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); diff --git a/test/runnable/aliasthis.d b/test/runnable/aliasthis.d index 9685ad547623..7bc675fcc640 100644 --- a/test/runnable/aliasthis.d +++ b/test/runnable/aliasthis.d @@ -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()