Debian Codegraph @

gcc/testsuite/gdc.test/runnable/test19223.d

raw
1
2 static if (__traits(compiles, __vector(int[4])))
3 {
4 alias int4 = __vector(int[4]);
5
6 int fn(const int[4] x)
7 {
8 int sum = 0;
9 foreach (i; x) sum += i;
10 return sum;
11 }
12
13 // https://issues.dlang.org/show_bug.cgi?id=19223
14 void test19223()
15 {
16 int4 v1 = int4.init;
17 assert(fn(v1.array) == 0);
18 assert(fn(int4.init.array) == 0);
19 }
20
21 // https://issues.dlang.org/show_bug.cgi?id=19607
22 void test19607()
23 {
24 int4 v1 = 1;
25 assert(fn(v1.array) == 4);
26 assert(fn(int4(2).array) == 8);
27 }
28
29 void main ()
30 {
31 test19223();
32 test19607();
33 }
34 }
35 else
36 {
37 void main() { }
38 }