Bug 7012 – Pure vector operations

Status
RESOLVED
Resolution
WORKSFORME
Severity
enhancement
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-11-25T16:44:00Z
Last change time
2013-07-09T10:02:30Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-11-25T16:44:15Z
I think vector ops need to become pure to allow code like: void main() pure nothrow { int[3] a = [1, 2, 2]; int[3] b = [10, 20, 20]; immutable int[3] c = a[] + b[]; } DMD 2.057head gives: test.d(4): Error: cannot implicitly convert expression (a[] + b[]) of type int[] to const(immutable(int)[])
Comment #1 by hsteoh — 2013-07-09T08:55:08Z
On latest git HEAD, dmd gives: test.d(4): Error: Array operation a[] + b[] not implemented So at least the message is more helpful. But it's still not working yet.
Comment #2 by bearophile_hugs — 2013-07-09T10:02:30Z
This compiles: void main() pure nothrow { int[3] a = [1, 2, 2]; int[3] b = [10, 20, 20]; int[3] c = void; c[] = a[] + b[]; } The error message caused by this line of code is not related to purity: immutable int[3] c = a[] + b[]; So this is closed.