Permalink
Browse files

Merge pull request #1532 from yebblies/issue9366

Fix Issue 9366 - Appending a value cast to void to a void[] crashes DMD
  • Loading branch information...
2 parents 71604e8 + 8e8dfac commit b42635616d31c71555cc6a68bdc06650060c9b58 @donc donc committed Jan 22, 2013
Showing with 10 additions and 2 deletions.
  1. +4 −2 src/expression.c
  2. +6 −0 test/runnable/xtest46.d
View
@@ -11469,7 +11469,8 @@ Expression *CatExp::semantic(Scope *sc)
*/
}
else if ((tb1->ty == Tsarray || tb1->ty == Tarray) &&
- e2->implicitConvTo(tb1next) >= MATCHconvert)
+ e2->implicitConvTo(tb1next) >= MATCHconvert &&
+ tb2->ty != Tvoid)
{
checkPostblit(e2->loc, tb2);
e2 = e2->implicitCastTo(sc, tb1next);
@@ -11482,7 +11483,8 @@ Expression *CatExp::semantic(Scope *sc)
return this;
}
else if ((tb2->ty == Tsarray || tb2->ty == Tarray) &&
- e1->implicitConvTo(tb2next) >= MATCHconvert)
+ e1->implicitConvTo(tb2next) >= MATCHconvert &&
+ tb1->ty != Tvoid)
{
checkPostblit(e1->loc, tb1);
e1 = e1->implicitCastTo(sc, tb2next);
@@ -2864,6 +2864,12 @@ int test137(){
/***************************************************/
+// 9366
+static assert(!is(typeof((void[]).init ~ cast(void)0)));
+static assert(!is(typeof(cast(void)0 ~ (void[]).init)));
+
+/***************************************************/
+
struct Size138
{
union

0 comments on commit b426356

Please sign in to comment.