Bug 3665 – Regression(1.051, 2.036) Assignment with array slicing does not work
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2010-01-02T09:01:00Z
Last change time
2014-04-18T09:12:06Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
kai
Comments
Comment #0 by kai — 2010-01-02T09:01:20Z
The following piece of code produces the error "Bug.d(13): Error: 'K[] = this.hash[]' is not of integral type, it is a ulong[]" with DMD 1.053 and DMD 1.054. It worked without problems in DMD 1.050.
final class Bug
{
private ulong hash[8];
protected void transform(ubyte[] input)
{
ulong K[8];
ulong block[8];
ulong state[8];
block[] = cast(ulong[]) input;
state[] = block[] ^ (K[] = hash[]);
}
}
Comment #1 by clugdbug — 2010-01-03T11:44:14Z
Workaround is to add [], changing this:
state[] = block[] ^ (K[] = hash[]);
into
state[] = block[] ^ (K[] = hash[])[];
Comment #2 by clugdbug — 2010-09-13T01:00:54Z
This is very simple: in arrayop.c, the assignment operators have been left out of the lists of valid operations.
PATCH:
bool isArrayOpValid(Expression *e), line 54.
case TOKand:
case TOKor:
case TOKpow:
case TOKand:
case TOKor:
case TOKpow:
+ case TOKassign:
+ case TOKaddass:
+ case TOKminass:
+ case TOKmulass:
+ case TOKdivass:
+ case TOKmodass:
+ case TOKxorass:
+ case TOKandass:
+ case TOKorass:
+ case TOKpowass:
return isArrayOpValid(((BinExp *)e)->e1) && isArrayOpValid(((BinExp *)e)->e2);
And again in isArrayOperand(), line 600
case TOKand:
case TOKor:
+ case TOKpow:
+ case TOKassign:
+ case TOKaddass:
+ case TOKminass:
+ case TOKmulass:
+ case TOKdivass:
+ case TOKmodass:
+ case TOKxorass:
+ case TOKandass:
+ case TOKorass:
+ case TOKpowass:
case TOKneg:
case TOKtilde:
return 1;