mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- 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:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
11
test/test_suite/arrays/inferred_array_slice_fail.c3
Normal file
11
test/test_suite/arrays/inferred_array_slice_fail.c3
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user