www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15154] New: Wrong overload resolution with implicit

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

          Issue ID: 15154
           Summary: Wrong overload resolution with implicit conversion of
                    another parameter
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: nachtraaf80 gmail.com

Overload resolution seems to see float and double as matching types when
another function parameter is implicitly converted (float4 to void16).

float dot_simd1(float4  a, float4 b)
{
    float4 result = __simd(XMM.DPPS, a, b, 0xFF);
    float value;
    __simd_sto(XMM.STOSS, value, result);
    return value;
}

The following error is produced by the code above:

simd1.d(34): Error: core.simd.__simd_sto called with argument types (XMM,
float, __vector(float[4])) matches both:
/usr/include/dlang/dmd/core/simd.d(434):     core.simd.__simd_sto(XMM opcode,
double op1, __vector(void[16]) op2)
and:
/usr/include/dlang/dmd/core/simd.d(435):     core.simd.__simd_sto(XMM opcode,
float op1, __vector(void[16]) op2)


When casting to the correct type (void16) the code compiles without errors:

float dot_simd1(float4  a, float4 b)
{
    float4 result = __simd(XMM.DPPS, a, b, 0xFF);
    float value;
    __simd_sto(XMM.STOSS, value, cast(void16)result);
    return value;
}

--
Oct 04 2015