zig/test/cases/bugs/655.zig
Andrew Kelley fcbb7426fa use * for pointer type instead of &
See #770

To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.

This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
2018-05-31 17:28:07 -04:00

13 lines
364 B
Zig

const std = @import("std");
const other_file = @import("655_other_file.zig");
test "function with &const parameter with type dereferenced by namespace" {
const x: other_file.Integer = 1234;
comptime std.debug.assert(@typeOf(&x) == *const other_file.Integer);
foo(x);
}
fn foo(x: *const other_file.Integer) void {
std.debug.assert(x.* == 1234);
}