progress toward compile time constant expression evaluation

This commit is contained in:
Andrew Kelley
2016-01-04 23:37:17 -07:00
parent 3c55162826
commit a11d0aaf62
5 changed files with 85 additions and 6 deletions

View File

@@ -777,6 +777,19 @@ pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 {
return 0;
}
)SOURCE", "OK\n");
add_simple_case("constant expressions", R"SOURCE(
use "std.zig";
const ARRAY_SIZE : u8 = 20;
pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 {
var array : [u8; ARRAY_SIZE];
print_u64(#sizeof(#typeof(array)));
print_str("\n");
return 0;
}
)SOURCE", "20\n");
}
////////////////////////////////////////////////////////////////////////////////////