d: Merge upstream dmd, druntime 5f7552bb28, phobos 67a47cf39.
[official-gcc.git] / gcc / testsuite / gdc.test / compilable / test17351.d
bloba04ade12476cafaf196d4779a0b3937acdfafe1a
1 // PERMUTE_ARGS: -preview=in
2 bool fun(S)(ref S[3] a) { assert(a == [42, 84, 169]); return true; }
3 bool fun2(S)(ref S a) { return true; }
4 void main()
6 static const int[3] sa = [42, 84, 169];
7 static const double sa2 = 42.42;
8 static assert(fun(sa));
9 static assert(fun2(sa2));
12 int f1(ref const int p) { return p; }
13 int f2(ref const int[2] p) { return p[0] + p[1]; }
14 void test2()
16 static immutable int[2] P = [ 0, 1 ];
17 static assert(f2(P) == 1);
18 immutable BigInt a, b;
19 static assert(glob1.twice == b.twice);
20 static assert(a.twice == b.twice);
23 struct BigInt { int[64] big; }
24 BigInt twice (in BigInt v) @safe pure nothrow @nogc { return v; }
26 immutable BigInt glob1 = BigInt.init;