aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/for_comptime_array_pointer.zig
blob: 48f461cf4261511f2406a6d439d29bece500aac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
export fn foo() void {
    comptime var elems: [3]u32 = undefined;
    for (&elems) |*elem| {
        _ = elem;
    }
}

// error
//
// :3:10: error: runtime value contains reference to comptime var
// :3:10: note: comptime var pointers are not available at runtime
// :2:34: note: 'runtime_value' points to comptime var declared here