Bug 6136 – Vector operation array[]^^ not supported yet

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-06-09T13:42:00Z
Last change time
2011-08-21T03:28:23Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-06-09T13:42:19Z
void main() { int[3] A = [1, 2, 3]; int[3] B; B[] = A[] * 2; // OK assert(B == [2, 4, 6]); B[] = A[] * A[]; // OK assert(B == [1, 4, 9]); B[] = A[] ^^ 2; // Error assert(B == [1, 4, 9]); B[] = A[] ^^ A[]; // Error assert(B == [1, 4, 27]); } DMD 2.053 gives: test.d(8): Error: incompatible types for ((A[]) ^^ (2)): 'int[]' and 'int' test.d(10): Error: incompatible types for ((A[]) ^^ (A[])): 'int[]' and 'int[]'
Comment #1 by ibuclaw — 2011-08-21T03:23:57Z
This has been discussed before in bug3661 Have raised a pull request to get this code accepted, it is now up to the library folk to optimise this routine, but I believe it's something that can't be vectorised, so there will probably be no performance benefit. https://github.com/D-Programming-Language/dmd/pull/325 Regards
Comment #2 by ibuclaw — 2011-08-21T03:28:23Z
*** This issue has been marked as a duplicate of issue 3661 ***