aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-25 23:18:18 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-25 23:18:18 -0400
commit300c83d8930d15d4bc4e34fe11e3b6bf3130ecc4 (patch)
tree265aaeaaddef394074b425c0798bf656a8b09cb9 /test
parent5f28a9d23851d94edc2b24e549b7c5abbbf23f68 (diff)
downloadzig-300c83d8930d15d4bc4e34fe11e3b6bf3130ecc4.tar.gz
zig-300c83d8930d15d4bc4e34fe11e3b6bf3130ecc4.zip
fix crash on field access of opaque type
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index efab136d7e..f3201aea9a 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2238,4 +2238,18 @@ pub fn addCases(cases: &tests.CompileErrorContext) {
\\}
,
".tmp_source.zig:37:16: error: cannot store runtime value in compile time variable");
+
+ cases.add("field access of opaque type",
+ \\const MyType = @OpaqueType();
+ \\
+ \\export fn entry() -> bool {
+ \\ var x: i32 = 1;
+ \\ return bar(@ptrCast(&MyType, &x));
+ \\}
+ \\
+ \\fn bar(x: &MyType) -> bool {
+ \\ return x.blah;
+ \\}
+ ,
+ ".tmp_source.zig:9:13: error: type '&MyType' does not support field access");
}