From 76c8efd56c84c189a52d3dc559fff109d5d34ce4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 5 Jun 2018 23:54:14 -0400 Subject: add test for not allowing implicit cast from T to [*]const T See #770 --- test/compile_errors.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/compile_errors.zig') 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 @@ -1,6 +1,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 { -- cgit v1.2.3