aboutsummaryrefslogtreecommitdiff
path: root/test/cases/eval.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-31 05:48:15 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-31 05:55:41 -0400
commit3ca027ca8219dbdbb6467645944c4daada037f51 (patch)
tree786a6c4ecac9f11d3a60f3c14c1b4276a3adc8d6 /test/cases/eval.zig
parent536c35136ab98f2f56d07937727b3c99c0e35c5c (diff)
downloadzig-3ca027ca8219dbdbb6467645944c4daada037f51.tar.gz
zig-3ca027ca8219dbdbb6467645944c4daada037f51.zip
first pass at zig build system
* `zig build --export [obj|lib|exe]` changed to `zig build_obj`, `zig build_lib` and `zig build_exe` respectively. * `--name` parameter is optional when it can be inferred from the root source filename. closes #207 * `zig build` now looks for `build.zig` which interacts with `std.build.Builder` to describe the targets, and then the zig build system prints TODO: build these targets. See #204 * add `@bitcast` which is mainly used for pointer reinterpret casting and make explicit casting not do pointer reinterpretation. Closes #290 * fix debug info for byval parameters * sort command line help options * `std.debug.panic` supports format string printing * add `std.mem.IncrementingAllocator` * fix const ptr to a variable with data changing at runtime. closes #289
Diffstat (limited to 'test/cases/eval.zig')
-rw-r--r--test/cases/eval.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/cases/eval.zig b/test/cases/eval.zig
index b1d10ca8bf..0d52985329 100644
--- a/test/cases/eval.zig
+++ b/test/cases/eval.zig
@@ -284,3 +284,18 @@ fn testCompTimeUIntComparisons(x: u32) {
@compileError("this condition should be comptime known");
}
}
+
+
+
+test "const ptr to variable data changes at runtime" {
+ assert(foo_ref.name[0] == 'a');
+ foo_ref.name = "b";
+ assert(foo_ref.name[0] == 'b');
+}
+
+const Foo = struct {
+ name: []const u8,
+};
+
+var foo_contents = Foo { .name = "a", };
+const foo_ref = &foo_contents;