D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6136 - Vector operation array[]^^ not supported yet
Summary: Vector operation array[]^^ not supported yet
Status: RESOLVED DUPLICATE of issue 3661
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 13:42 UTC by bearophile_hugs
Modified: 2011-08-21 03:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2011-06-09 13:42:19 UTC
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 Iain Buclaw 2011-08-21 03:23:57 UTC
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 Iain Buclaw 2011-08-21 03:28:23 UTC

*** This issue has been marked as a duplicate of issue 3661 ***