Skip to content

Commit 76c8efd

Browse files
committed
add test for not allowing implicit cast from T to [*]const T
See #770
1 parent bd13e75 commit 76c8efd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/compile_errors.zig

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
const tests = @import("tests.zig");
22

33
pub fn addCases(cases: *tests.CompileErrorContext) void {
4+
cases.add(
5+
"attempted implicit cast from T to [*]const T",
6+
\\export fn entry() void {
7+
\\ const x: [*]const bool = true;
8+
\\}
9+
,
10+
".tmp_source.zig:2:30: error: expected type '[*]const bool', found 'bool'",
11+
);
12+
413
cases.add(
514
"dereference unknown length pointer",
615
\\export fn entry(x: [*]i32) i32 {

0 commit comments

Comments
 (0)