aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/runtime_value_in_comptime_array.zig
diff options
context:
space:
mode:
authorJackson Wambolt <jtwambolt@gmail.com>2025-06-28 19:33:38 -0500
committerMatthew Lugg <mlugg@mlugg.co.uk>2025-07-31 22:28:46 +0100
commit264bd7053edb948d0f96525b54b859c0422e12a2 (patch)
tree35ea671688ad92693f4579c6de89f9a1f6e3b98e /test/cases/compile_errors/runtime_value_in_comptime_array.zig
parentac1e73e249f8ce06bc7c89d2bdc4359b0399236c (diff)
downloadzig-264bd7053edb948d0f96525b54b859c0422e12a2.tar.gz
zig-264bd7053edb948d0f96525b54b859c0422e12a2.zip
Sema: remove incorrect `requireRuntimeBlock` calls
Part of #22353 Resolves: #24273 Co-Authored-By: Matthew Lugg <mlugg@mlugg.co.uk>
Diffstat (limited to 'test/cases/compile_errors/runtime_value_in_comptime_array.zig')
-rw-r--r--test/cases/compile_errors/runtime_value_in_comptime_array.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cases/compile_errors/runtime_value_in_comptime_array.zig b/test/cases/compile_errors/runtime_value_in_comptime_array.zig
new file mode 100644
index 0000000000..804cd258fb
--- /dev/null
+++ b/test/cases/compile_errors/runtime_value_in_comptime_array.zig
@@ -0,0 +1,14 @@
+fn comptimeArray(comptime _: []const u8) void {}
+fn bar() u8 {
+ return 123;
+}
+export fn entry() void {
+ const y = bar();
+ comptimeArray(&.{y});
+}
+
+// error
+//
+// :7:19: error: unable to resolve comptime value
+// :7:19: note: argument to comptime parameter must be comptime-known
+// :1:18: note: parameter declared comptime here