You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following minimal reproduction compiles with an unexpected error. Where types are unequal due to constness however it is in the direction where a const function can't receive a non-const parameter
> zig build-exe test.zig
/usr/local/zig-linux-x86_64-0.12.0-dev.3639+9cfac4718/lib/std/hash_map.zig:340:13: error: Problems found with hash context type hash_map.StringContext:
hash_map.StringContext.hash must be fn (self, []u8) u64
but is actually fn (hash_map.StringContext, []const u8) u64
Second parameter must be []u8, but is []const u8
hash_map.StringContext.eql must be fn (self, []u8, []const u8) bool
but is actually fn (hash_map.StringContext, []const u8, []const u8) bool
Second parameter must be []u8, but is []const u8
@compileError("Problems found with hash context type " ++ @typeName(Context) ++ ":" ++ errors);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/zig-linux-x86_64-0.12.0-dev.3639+9cfac4718/lib/std/hash_map.zig:1174:35: note: called from here
comptime verifyContext(@TypeOf(ctx), @TypeOf(key), K, Hash, false);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/zig-linux-x86_64-0.12.0-dev.3639+9cfac4718/lib/std/hash_map.zig:1337:48: note: called from here
const index = self.getIndex(key, key_ctx) orelse return err;
Expected Behavior
The program to compile as casting to const is safe
The text was updated successfully, but these errors were encountered:
vkitchen
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Apr 13, 2024
Zig Version
0.12.0-dev.3639+9cfac4718
Steps to Reproduce and Observed Behavior
The following minimal reproduction compiles with an unexpected error. Where types are unequal due to constness however it is in the direction where a const function can't receive a non-const parameter
Compiles with the following error
Expected Behavior
The program to compile as casting to const is safe
The text was updated successfully, but these errors were encountered: