summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/compilable/test19224.d
blob: 4020e0daea0b9200b256f6ddbf523f8e79bbd010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// https://issues.dlang.org/show_bug.cgi?id=19224
static if (__traits(compiles, __vector(float[4])))
{
    float sum(const float[4] val)
    {
        float sum = 0;
        foreach (x; val) sum += x;
        return sum;
    }

    alias float4 = __vector(float[4]);

    enum x = sum(float4.init.array);
    static assert(x is float.nan);

    enum y = sum(float4(1).array);
    static assert(y == 4);
}