Skip to content

Commit

Permalink
fix Issue 10282 - Refused assignment of vector op result to const array
Browse files Browse the repository at this point in the history
  • Loading branch information
9rnsr committed Jun 4, 2015
1 parent 920d18e commit a7ec2c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -11821,6 +11821,8 @@ Expression *AssignExp::semantic(Scope *sc)
(isUnaArrayOp(e2->op) || isBinArrayOp(e2->op)))
{
type = e1->type;
if (op == TOKconstruct) // Bugzilla 10282: tweak mutability of e1 element
e1->type = e1->type->nextOf()->mutableOf()->arrayOf();
return arrayOp(this, sc);
}

Expand Down
13 changes: 13 additions & 0 deletions test/runnable/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,18 @@ void test9656()
}
}

/************************************************************************/
// 10282

void test10282()
{
int[3] a1 = [1, 3, 6];
int[3] a2 = [1, 3, 6] * 3; // OK
const int[3] a3 = a1[] * 3; // OK <- Error
const int[3] a4 = [1, 3, 6] * 3; // OK <- Error
immutable int[3] a5 = [1, 3, 6] * 3; // OK <- Error
}

/************************************************************************/
// 10433

Expand Down Expand Up @@ -859,6 +871,7 @@ int main()
test8390();
test8651();
test9656();
test10282();
test10433();
test10684a();
test10684b();
Expand Down

0 comments on commit a7ec2c0

Please sign in to comment.