commit 1568470c44eafb59425c070ea9884b78cc2516b2 (tree)
parent db4c06ce606dcfe989b5c1f76d5ed00e90d5dd9f
Author: Michael Dusan <michael.dusan@gmail.com>
Date: Fri, 3 Apr 2020 21:04:22 -0400
Merge pull request #4891 from mikdusan/issue4207
add compiler-error test: coerce
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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",
+ });
}