www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15145] New: Array initializers for SIMD not working inside

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

          Issue ID: 15145
           Summary: Array initializers for SIMD not working inside
                    functions.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: rejects-valid, SIMD
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: Marco.Leise gmx.de

Practically this compiles:

  import core.simd, std.range, std.array;
  ubyte[16] a = ubyte(16).iota.array;
  ubyte16   b = ubyte(16).iota.array;

But simply moving the definition inside a function does not work:

  void main()
  {
    import core.simd, std.range, std.array;
    ubyte16 b = ubyte(16).iota.array;
  }

Error: cannot implicitly convert expression (array(iota(cast(ubyte)16u))) of
type ubyte[] to __vector(ubyte[16])

To be fair it works when you declare the vector as static, and that should
probably be done for performance, but it should not be an error and the message
is too general, as it works for static/global vectors.

--
Oct 03 2015