Last active
April 4, 2018 14:20
-
-
Save BraedonWooding/2758d8c0979345c9f90ad02a3db9f219 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn foo(array: []const i32, other: []const i32)bool { | |
warn("TEST"); | |
return true; | |
} | |
fn other(array: []const u8, other: []const u8)bool { | |
warn("TEST"); | |
return true; | |
} | |
fn k(comptime T: type, func: fn(array: T, other: T)bool, array: T) void { | |
warn("FOO"); | |
_ = func(array, array); | |
} | |
test "Test" { | |
var array = []i32 { 0, 1, 2}; | |
k([]i32, foo, array[0..]); | |
var str = "BOOOO"; | |
// This line won't compile | |
k([]u8, other, str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't cast a [5]i32 to []i32. You have to slice it, like you do on line 18. You can only implicitly cast [5]i32 to []const i32.