D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19632 - [SIMD] Error: invalid foreach aggregate
Summary: [SIMD] Error: invalid foreach aggregate
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: pull, SIMD
Depends on:
Blocks:
 
Reported: 2019-01-29 22:04 UTC by Iain Buclaw
Modified: 2020-12-29 10:40 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2019-01-29 22:04:05 UTC
int doubleAndSumInt(int4 v)
{
    int sum = 0;
    foreach (ref e; v)
        sum += (e *= 2);
    return sum;
}
Comment 1 Stefan Koch 2019-01-30 00:11:56 UTC
Ah yes.

I know about this one ;)

I don't think it's important ... throw a -vcg-ast at it and you will see why it fails.
Comment 2 Walter Bright 2020-12-28 09:37:05 UTC
Replacing the v in the foreach with v.array will enable it to work. It's not documented to work without the .array, so I'm setting this as an enhancement request.
Comment 3 Dlang Bot 2020-12-29 09:54:11 UTC
@WalterBright created dlang/dmd pull request #12065 "fix Issue 19632 - [SIMD] Error: invalid foreach aggregate" fixing this issue:

- fix Issue 19632 - [SIMD] Error: invalid foreach aggregate

https://github.com/dlang/dmd/pull/12065
Comment 4 Dlang Bot 2020-12-29 10:40:08 UTC
dlang/dmd pull request #12065 "fix Issue 19632 - [SIMD] Error: invalid foreach aggregate" was merged into master:

- cbb2d8f9a7eeadbd143d8ab4953c849c7e59454a by Walter Bright:
  fix Issue 19632 - [SIMD] Error: invalid foreach aggregate

https://github.com/dlang/dmd/pull/12065