Showing with 15 additions and 0 deletions.
  1. +2 −0 src/expression.c
  2. +13 −0 test/runnable/arrayop.d
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