aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-07 12:21:20 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-07 12:21:20 -0500
commita94304d3e4b9220d2b22501eb2666e5aa89df236 (patch)
treea3b85b53581853b62dabf6f763feca099e4fee84 /test/compile_errors.zig
parentd974afde1d366a28f1b07bff6ebfb5c5756d3b61 (diff)
parent2b2bf53a49616192e2b2bdf40b88400964ff1500 (diff)
downloadzig-a94304d3e4b9220d2b22501eb2666e5aa89df236.tar.gz
zig-a94304d3e4b9220d2b22501eb2666e5aa89df236.zip
Merge remote-tracking branch 'origin/master' into llvm8
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 30d9ca5d70..acd1eada06 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,25 @@ const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "threadlocal qualifier on const",
+ \\threadlocal const x: i32 = 1234;
+ \\export fn entry() i32 {
+ \\ return x;
+ \\}
+ ,
+ ".tmp_source.zig:1:13: error: threadlocal variable cannot be constant",
+ );
+
+ cases.add(
+ "threadlocal qualifier on local variable",
+ \\export fn entry() void {
+ \\ threadlocal var x: i32 = 1234;
+ \\}
+ ,
+ ".tmp_source.zig:2:5: error: function-local variable 'x' cannot be threadlocal",
+ );
+
+ cases.add(
"@bitCast same size but bit count mismatch",
\\export fn entry(byte: u8) void {
\\ var oops = @bitCast(u7, byte);