| 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() |
| 5 |
{ |
| 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)); |
| 10 |
} |
| 11 |
|
| 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() |
| 15 |
{ |
| 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); |
| 21 |
} |
| 22 |
|
| 23 |
struct BigInt { int[64] big; } |
| 24 |
BigInt twice (in BigInt v) @safe pure nothrow @nogc { return v; } |
| 25 |
|
| 26 |
immutable BigInt glob1 = BigInt.init; |