www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17721] New: Wrong expression type using vector extensions

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

          Issue ID: 17721
           Summary: Wrong expression type using vector extensions with
                    certain operands
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ibuclaw gdcproject.org

The operands encapsulated by the following classes have a result type that is
implicitly bool.

CmpExp
EqualExp
IdentityExp


The operands encapsulated by the following classes have a result type that is
implicitly int.

ShlExp
ShrExp
UshrExp


When handling vectors, the resultant type of the expression should also be a
vector. i.e:
---
float4 f1 = [1, 9, 8, 9];
float4 f2 = [2, 8, 0, 5];
float4 fr = f1 > f2;
assert((f1 > f2).array == [0, -1, -1, -1]);

int4 i1 = [1, 2, 3, 4];
int4 i2 = [2, 4, 8, 16];
int4 ir = i1 << i2;
assert(ir.array == [4, 32, 768, 262144]);
---

This is not a concern for dmd, who rejects these operands.

--
Aug 04 2017