Files
c3c/test/unit/regression/pointer_non_decay.c3
2023-03-02 19:47:24 +01:00

19 lines
353 B
C

module test @test;
fn void pointer_non_decay()
{
int[3] x;
int[3]* y = &x;
int* z = y;
int[] sub = y;
int[3] y1 = y[1];
int z1 = z[1];
int* xx = &x + 1;
int[3]* yy = (int[3]*)(xx);
int* zz = yy - 1;
assert(y == z);
assert(z == zz);
assert(&(*y)[1] == &xx[-2]);
x[1] = 123;
assert(x[1] == z[1]);
}