add test for not allowing implicit cast from T to [*]const T

See #770
This commit is contained in:
Andrew Kelley 2018-06-05 23:54:14 -04:00
parent bd13e757e7
commit 76c8efd56c

View File

@ -1,6 +1,15 @@
const tests = @import("tests.zig"); const tests = @import("tests.zig");
pub fn addCases(cases: *tests.CompileErrorContext) void { 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( cases.add(
"dereference unknown length pointer", "dereference unknown length pointer",
\\export fn entry(x: [*]i32) i32 { \\export fn entry(x: [*]i32) i32 {