aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-04 23:12:34 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-05 13:22:21 +0200
commitea48f06fc2965ff2e9516c23e58a50a9db5da84b (patch)
treeeba6d1e1a58ca6c77c69c73ca23506092b64ed86 /test
parentf96748ebc19b0c083569e7677f65fe4454c32b57 (diff)
downloadzig-ea48f06fc2965ff2e9516c23e58a50a9db5da84b.tar.gz
zig-ea48f06fc2965ff2e9516c23e58a50a9db5da84b.zip
stage2: address of threadlocal variable is not comptime known
Closes #13215
Diffstat (limited to 'test')
-rw-r--r--test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig b/test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig
new file mode 100644
index 0000000000..d2d62c82ab
--- /dev/null
+++ b/test/cases/compile_errors/address_of_threadlocal_not_comptime_known.zig
@@ -0,0 +1,13 @@
+threadlocal var global: u32 = 23;
+threadlocal var global_ptr: *u32 = &global;
+
+pub export fn entry() void {
+ if (global_ptr.* != 23) unreachable;
+}
+
+// error
+// backend=stage2
+// target=native
+//
+// :2:36: error: unable to resolve comptime value
+// :2:36: note: container level variable initializers must be comptime-known