mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-04 00:55:49 +03:00
arrays: Disalllow void array block assignment
This commit is contained in:
parent
63337b278a
commit
eb96b8ab44
1 changed files with 12 additions and 1 deletions
|
@ -263,7 +263,18 @@ void DtoArrayAssign(Loc& loc, DValue* lhs, DValue* rhs, int op, bool canSkipPost
|
||||||
LLValue* lhsLength = DtoArrayLen(lhs);
|
LLValue* lhsLength = DtoArrayLen(lhs);
|
||||||
|
|
||||||
// TODO: This should use AssignExp::ismemset.
|
// TODO: This should use AssignExp::ismemset.
|
||||||
if (!t2->implicitConvTo(t->nextOf()))
|
// Disallow void array block assignment (DMD issue 7493).
|
||||||
|
bool canBeBlockAssignment = true;
|
||||||
|
if (!rhs->isNull())
|
||||||
|
{
|
||||||
|
Type *leafElemType = elemType;
|
||||||
|
while (leafElemType->ty == Tarray)
|
||||||
|
{
|
||||||
|
leafElemType = leafElemType->nextOf();
|
||||||
|
}
|
||||||
|
canBeBlockAssignment = leafElemType->ty != Tvoid;
|
||||||
|
}
|
||||||
|
if (!t2->implicitConvTo(t->nextOf()) || !canBeBlockAssignment)
|
||||||
{
|
{
|
||||||
// T[] = T[] T[] = T[n]
|
// T[] = T[] T[] = T[n]
|
||||||
// T[n] = T[n] T[n] = T[]
|
// T[n] = T[n] T[n] = T[]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue