From 8b6a06eefe8738896a6657c86af5770250e0b67a Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Fri, 3 Apr 2020 19:11:51 -0400 Subject: [PATCH] add compiler-error test: coerce Issue fixed by an unknown commit. closes #4207 --- test/compile_errors.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/compile_errors.zig b/test/compile_errors.zig index a3c29e0dd6..166ed67561 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -7152,4 +7152,14 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { ":39:29: error: slice-sentinel does not match target-sentinel", ":46:29: error: slice-sentinel does not match target-sentinel", }); + + cases.add("issue #4207: coerce from non-terminated-slice to terminated-pointer", + \\export fn foo() [*:0]const u8 { + \\ var buffer: [64]u8 = undefined; + \\ return buffer[0..]; + \\} + , &[_][]const u8{ + ":3:18: error: expected type '[*:0]const u8', found '*[64]u8'", + ":3:18: note: destination pointer requires a terminating '0' sentinel", + }); }