- Empty ichar slice + byte concatenation hit an assert. #2789

This commit is contained in:
Christoffer Lerno
2026-01-22 21:39:03 +01:00
parent bf50178eb3
commit 1845a515ca
4 changed files with 10 additions and 1 deletions

View File

@@ -107,6 +107,7 @@
- Recursive definition of tag not detected with nested tag/tagof #2790
- Attrdef eval environment lacked rtype, causing error on invalid args #2797
- $typeof(<type>) returns typeinfo, causing errors #2795.
- Empty ichar slice + byte concatenation hit an assert. #2789
### Stdlib changes
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.

View File

@@ -146,6 +146,8 @@ static bool sema_concat_bytes_and_other(SemaContext *context, Expr *expr, Expr *
ArraySize len = left->const_expr.bytes.len;
bool is_bytes = left->const_expr.const_kind == CONST_BYTES;
Type *indexed = type_get_indexed_type(left->type);
bool const_cast = sema_cast_const(right);
ASSERT(const_cast);
const char *left_bytes = left->const_expr.bytes.ptr;
RETRY:;
switch (right->const_expr.const_kind)

View File

@@ -533,7 +533,8 @@ static bool sema_expr_analyse_designated_initializer(SemaContext *context, Type
if (!result) return false;
bool is_bitmember = member && member->decl_kind == DECL_VAR && member->var.kind == VARDECL_BITMEMBER;
Expr *value = expr->designator_expr.value;
if (!value && is_bitmember && member->var.start_bit == member->var.end_bit && type_flatten(result) == type_bool) {
if (!value && is_bitmember && member->var.start_bit == member->var.end_bit && type_flatten(result) == type_bool)
{
ASSERT(is_bitstruct);
value = expr_new_const_bool(INVALID_SPAN, type_bool, true);
expr->designator_expr.value = value;

View File

@@ -0,0 +1,5 @@
fn int main()
{
const A = (ichar[]) { } +++ x'1234';
return 0;
}