- Empty struct after @if processing was not detected, causing a crash instead of an error.

- Comparing an uint and int[<4>] was incorrectly assumed to be uint compared to int, causing a crash instead of an error.
- When an `int[*][6]` was given too few values, the compiler would assert instead of giving an error.
This commit is contained in:
Christoffer Lerno
2026-01-20 00:04:18 +01:00
parent 4512c6446d
commit 0b9b49673e
3 changed files with 16 additions and 0 deletions

View File

@@ -84,6 +84,7 @@
- Empty struct after `@if` processing was not detected, causing a crash instead of an error. #2771
- Comparing an uint and int[<4>] was incorrectly assumed to be uint compared to int, causing a crash instead of an error. #2771
- When an `int[*][6]` was given too few values, the compiler would assert instead of giving an error. #2771
- Inferring length from a slice was accidentally not an error.
### Stdlib changes
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.

View File

@@ -1193,6 +1193,10 @@ static bool rule_slice_to_infer(CastContext *cc, bool is_explicit, bool is_silen
static bool rule_vecarr_to_infer(CastContext *cc, bool is_explicit, bool is_silent)
{
Type *new_type = type_infer_len_from_actual_type(cc->to, cc->from);
if (type_is_inferred(new_type))
{
return sema_cast_error(cc, false, is_silent);
}
cast_context_set_to(cc, new_type);
return cast_is_allowed(cc, is_explicit, is_silent);
}

View File

@@ -0,0 +1,11 @@
import std;
macro test(int[*][1] a) {
var b = a;
}
fn int main()
{
int[][1] b;
test(b); // #error: It is not possible to cast 'int[][1]' to 'int[*][1]'
return 12;
}