Bug 10306 – Array ^^ operator doesn't support complex expressions

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-08T14:58:00Z
Last change time
2015-06-04T07:12:09Z
Keywords
diagnostic, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2013-06-08T14:58:04Z
import std.math; void main() { double[3] a, b, c; double[3] r1 = (a[] - b[]) * c[]; // line 4, OK double[3] aux = a[] - b[]; // OK double[3] r2 = aux[] ^^ 2; // OK double[3] r3 = (a[] - b[]) ^^ 2; // line 7, error double[3] r4 = (a[] - b[])[] ^^ 2; // line 8, error } dmd 2.064alpha gives: temp.d(7): Error: incompatible types for ((a[] - b[]) ^^ (cast(double)2)): 'double[]' and 'double' If you comment out line 7 you receive: temp.d(8): Error: Array operation a[] - b[] not implemented I'd like the ^^ array op support a complex expression as in line 4. Also the error messages are a little confusing.
Comment #1 by bearophile_hugs — 2013-06-08T15:09:57Z
*** Issue 8588 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2013-11-20T03:48:12Z
*** Issue 11085 has been marked as a duplicate of this issue. ***
Comment #3 by k.hara.pg — 2015-06-04T07:12:09Z
(In reply to bearophile_hugs from comment #0) [snip] All lines work as expected with 2.067. > dmd 2.064alpha gives: > temp.d(7): Error: incompatible types for ((a[] - b[]) ^^ (cast(double)2)): > 'double[]' and 'double' Works since 2.065, fixed by: https://github.com/D-Programming-Language/dmd/pull/2960 > If you comment out line 7 you receive: > temp.d(8): Error: Array operation a[] - b[] not implemented Works since 2.067, fixed by: https://github.com/D-Programming-Language/dmd/pull/4007