diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-06-05 23:54:14 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-06-05 23:54:14 -0400 |
| commit | 76c8efd56c84c189a52d3dc559fff109d5d34ce4 (patch) | |
| tree | bb83542e72d89dee4bf4fecd73e5a02d0249d63f | |
| parent | bd13e757e7e36994d2a1fd4595c617d14e22b7c6 (diff) | |
| download | zig-76c8efd56c84c189a52d3dc559fff109d5d34ce4.tar.gz zig-76c8efd56c84c189a52d3dc559fff109d5d34ce4.zip | |
add test for not allowing implicit cast from T to [*]const T
See #770
| -rw-r--r-- | test/compile_errors.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 412b2d5fc9..c995cd679e 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,15 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "attempted implicit cast from T to [*]const T", + \\export fn entry() void { + \\ const x: [*]const bool = true; + \\} + , + ".tmp_source.zig:2:30: error: expected type '[*]const bool', found 'bool'", + ); + + cases.add( "dereference unknown length pointer", \\export fn entry(x: [*]i32) i32 { \\ return x.*; |
