The following example, attempting useful operations, fails to compile:
import std.complex;
void main()
{
alias T = Complex!float;
T iV = complex(2.0f, 0.0f);
T[] arr = [iV,iV,iV,iV,iV,iV];
T[] result = new T[arr.length];
result[] = arr[] * iV;
result[] = iV * arr[];
result[] = arr[] * 2.0f;
result[] = 2.0f * arr[];
}
The error messages are as follows:
onlineapp.d(10): Error: incompatible types for (arr[]) * (iV): Complex!float[] and Complex!float
onlineapp.d(11): Error: incompatible types for (iV) * (arr[]): Complex!float and Complex!float[]
onlineapp.d(12): Error: incompatible types for (arr[]) * (2.00000F): Complex!float[] and float
onlineapp.d(13): Error: incompatible types for (2.00000F) * (arr[]): float and Complex!float[]
Comment #1 by razvan.nitu1305 — 2021-09-30T11:10:03Z
This doesn't work for any type, not just complex. Changing to a dmd bug.
Comment #2 by dlang-bot — 2021-10-10T21:34:39Z
@sorin-gabriel created dlang/dmd pull request #13154 "Fix issue 19294 - Support for array operations with Complex! is incom…" fixing this issue:
- Fix issue 19294 - Support for array operations with Complex! is incomplete (partial fix, only for operands of the same type)
https://github.com/dlang/dmd/pull/13154
Comment #3 by dlang-bot — 2021-11-08T08:08:44Z
dlang/dmd pull request #13154 "Partial fix issue 19294 - Support for array operations with Complex! is incomplete" was merged into master:
- 5aaf9679581ef70525e2e590302bf49cf571f583 by Gabriel:
Partial fix issue 19294 - Support for array operations with Complex! is incomplete
https://github.com/dlang/dmd/pull/13154
Comment #4 by dlang-bot — 2021-11-15T12:58:42Z
@sorin-gabriel created dlang/dmd pull request #13307 "Partial fix issue 19294 (Updated with broader support for array operations)" fixing this issue:
- Fix issue 19294 - Support for array operations with Complex! is incomplete (partial fix, only for operands of the same type)
- Revert "Fix issue 19294 - Support for array operations with Complex! is incomplete (partial fix, only for operands of the same type)"
This reverts commit 6d00a9c0474084fcfaca624140752422cc639bbc.
https://github.com/dlang/dmd/pull/13307
Comment #5 by dlang-bot — 2021-11-22T07:23:58Z
dlang/dmd pull request #13307 "Partial fix issue 19294 (Updated with broader support for array operations)" was merged into master:
- 475b3220c4cdb60a5773582504468f7ad4273f47 by Gabriel:
Partial fix issue 19294 (Updated with broader support for array operations)
https://github.com/dlang/dmd/pull/13307
Comment #6 by dlang-bot — 2022-01-24T11:48:37Z
@WalterBright updated dlang/dmd pull request #13368 "fix Issue 22127 - compiler assertion failure parser on UDA and functi…" mentioning this issue:
- Partial fix issue 19294 - Support for array operations with Complex! is incomplete (#13154)
Partial fix issue 19294 - Support for array operations with Complex! is incomplete
Signed-off-by: Razvan Nitu <[email protected]>
Merged-on-behalf-of: Razvan Nitu <[email protected]>
https://github.com/dlang/dmd/pull/13368
Comment #7 by robert.schadek — 2024-12-13T19:00:47Z