www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19294] New: Support for array operations with Complex! is

https://issues.dlang.org/show_bug.cgi?id=19294

          Issue ID: 19294
           Summary: Support for array operations with Complex! is
                    incomplete
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: asumface gmail.com

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[]

--
Oct 08 2018