Bug 8350 – Misleading error message with invalid array operation
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-05T16:05:00Z
Last change time
2013-11-26T07:39:29Z
Keywords
diagnostic
Assigned to
nobody
Creator
bioinfornatics
Comments
Comment #0 by bioinfornatics — 2012-07-05T16:05:15Z
size_t[] a = [0, 1, 2, 3];
a[] += 1; // ---> implemented
size_t[] b = a[] + 1; // ---> Not yet implemented
---------------------
import std.stdio;
void main(){
size_t[] a = [0, 1, 2, 3];
size_t[] b = a[] + 1;
writeln( a );
}
Comment #1 by yebblies — 2012-07-07T04:27:32Z
The error message here is wrong, it's not that the array operation isn't implemented, it's that 'size_t[] b = a[] + 1;' is not a valid array operation, it would require allocating storage for b.
Comment #2 by yebblies — 2013-11-26T07:39:29Z
Now gives:
DMD v2.065 DEBUG
testx.d(4): Error: invalid array operation b = a[] + 1u (did you forget a [] ?)