mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-28 19:47:08 +03:00
90f08a69aa
This also adds some float-related instructions to MIR/Emit
21 lines
643 B
Zig
21 lines
643 B
Zig
const std = @import("std");
|
|
const testing = std.testing;
|
|
const builtin = @import("builtin");
|
|
|
|
const a = [_]u8{ 1, 2, 3 };
|
|
|
|
fn checkAddress(s: []const u8) !void {
|
|
for (s) |*i, j| {
|
|
try testing.expect(i == &a[j]);
|
|
}
|
|
}
|
|
|
|
test "slices pointing at the same address as global array." {
|
|
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
|
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
|
|
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
|
try checkAddress(&a);
|
|
comptime try checkAddress(&a);
|
|
}
|