Skip to content

Commit

Permalink
fix Issue 14895 - ICE on array operation when its result is concatenated
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jan 31, 2016
1 parent 84f6aaf commit 67392af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/expression.d
Expand Up @@ -13180,6 +13180,12 @@ public:
return e;
Type tb1 = e1.type.toBasetype();
Type tb2 = e2.type.toBasetype();

auto f1 = checkNonAssignmentArrayOp(e1);
auto f2 = checkNonAssignmentArrayOp(e2);
if (f1 || f2)
return new ErrorExp();

/* BUG: Should handle things like:
* char c;
* c ~ ' '
Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/fail_arrayop2.d
Expand Up @@ -180,3 +180,16 @@ void test13910()
return !!((data[segmentId][28..29]) & (1 << 0));
}
}

/*
TEST_OUTPUT:
---
fail_compilation/fail_arrayop2.d(194): Error: array operation a[] + 1 without destination memory not allowed
fail_compilation/fail_arrayop2.d(194): Error: array operation a[] * 2 without destination memory not allowed
---
*/
void test14895()
{
int[] a;
int[] b = (a[] + 1) ~ a[] * 2;
}

0 comments on commit 67392af

Please sign in to comment.