implement #sizeof()

closes #8
This commit is contained in:
Andrew Kelley
2016-01-03 19:38:36 -07:00
parent fa6e3eec46
commit e64c0941f9
6 changed files with 177 additions and 56 deletions

View File

@@ -698,16 +698,17 @@ fn outer() -> isize {
}
)SOURCE", "OK\n");
add_simple_case("#typeof()", R"SOURCE(
add_simple_case("#sizeof() and #typeof()", R"SOURCE(
use "std.zig";
const x: u16 = 13;
const z: #typeof(x) = 19;
pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 {
const y: #typeof(x) = 120;
print_str("OK\n");
print_u64(#sizeof(#typeof(y)));
print_str("\n");
return 0;
}
)SOURCE", "OK\n");
)SOURCE", "2\n");
}
////////////////////////////////////////////////////////////////////////////////////