diff --git a/lib/std/core/allocators/mem_allocator_fn.c3 b/lib/std/core/allocators/mem_allocator_fn.c3 index 1b3546816..6ef9eb42b 100644 --- a/lib/std/core/allocators/mem_allocator_fn.c3 +++ b/lib/std/core/allocators/mem_allocator_fn.c3 @@ -77,7 +77,7 @@ macro void*! @aligned_realloc(#calloc_fn, #free_fn, void* old_pointer, usz bytes AlignedBlock* desc = (AlignedBlock*)old_pointer - 1; void* data_start = desc.start; void* new_data = @aligned_calloc(#calloc_fn, bytes, alignment, offset)!; - mem::copy(new_data, old_pointer, desc.len > bytes ? desc.len : bytes, mem::DEFAULT_MEM_ALIGNMENT, mem::DEFAULT_MEM_ALIGNMENT); + mem::copy(new_data, old_pointer, desc.len < bytes ? desc.len : bytes, mem::DEFAULT_MEM_ALIGNMENT, mem::DEFAULT_MEM_ALIGNMENT); $if $checks(#free_fn(data_start)!): #free_fn(data_start)!; $else diff --git a/src/compiler/sema_casts.c b/src/compiler/sema_casts.c index 3b986bae8..e98ed398b 100644 --- a/src/compiler/sema_casts.c +++ b/src/compiler/sema_casts.c @@ -1556,6 +1556,8 @@ static bool cast_expr_inner(SemaContext *context, Expr *expr, Type *to_type, boo } Type *to = is_explicit ? type_flatten(to_type) : type_no_optional(to_type)->canonical; + if (!sema_resolve_type_decl(context, to)) return false; + if (!sema_resolve_type_decl(context, from_type)) return false; // Step one, cast from optional. // This handles: diff --git a/src/version.h b/src/version.h index 7e3183ddf..269ea355b 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.4.586" \ No newline at end of file +#define COMPILER_VERSION "0.4.587" \ No newline at end of file