aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/store_to_comptime_var_through_call.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/cases/compile_errors/store_to_comptime_var_through_call.zig b/test/cases/compile_errors/store_to_comptime_var_through_call.zig
new file mode 100644
index 0000000000..0fb1246e31
--- /dev/null
+++ b/test/cases/compile_errors/store_to_comptime_var_through_call.zig
@@ -0,0 +1,15 @@
+export fn entry(b: bool) void {
+ comptime var int = 0;
+ if (b) {
+ comptime incr(&int);
+ }
+}
+fn incr(x: *comptime_int) void {
+ x.* += 1;
+}
+
+// error
+//
+// :8:9: error: store to comptime variable depends on runtime condition
+// :3:9: note: runtime condition here
+// :4:22: note: called from here